Hello,
I’m trying to get up and running with GLFW and haven’t had much luck. I’m on Linux Mint using GCC 7.3.0.
I cloned the GLFW repo, built the libraries, and ran make install.
Now I have a simple CMakeLists.txt:
cmake_minimum_required(VERSION 3.5)
project(hello-glfw)
set(GLFW_DIR /usr/local/lib/cmake/glfw3)
add_executable(hello-glfw hello-glfw.cpp)
find_package(glfw3 REQUIRED)
find_package(OpenGL REQUIRED)
target_link_libraries(hello-glfw OpenGL glfw3)
I can run CMake from here, no problems.
My source code (hello-glfw.cpp) is just copy-pasted from one of the GLFW guides):
#include <GL/glut.h>
#include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
The above code gives me an error: undefined reference to symbol ‘dlclose@GLIBC_2.2.5’.
A few minutes of google searching told me to include the ‘dl’ library. I updated my target_link_libraries to:
target_link_libraries(hello-glfw dl OpenGL glfw3)
But I’m still getting the error.
Any thoughts?
Thanks in advance!