Well, im trying to get started with GLFW, but i am getting some troubles when i try to link the libraries.
I'm trying to compile the first example of the GLFW page.
#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;
}
Compiler
g++ -L. libglfw3dll.a -lglfw3 -lopengl32 main.cpp
In my project folder i have
glfw3.dll
libglfw3dll.a
When i try to compile it, i get this linker error
undefined reference to `__imp_glClear'
What am i doing wrong?
/---------------------- Edit ----------------------------/
Sorry, i forgot to say some things, that could clarify a little bit my situation...
I'm working on Windows 10, 64 bits.
Compiler -> Mingw Binaries -> Downloaded from the official page
I tried to compile the code with the static libraries and i got a lot of undefined references.
g++ -L. -lopengl32 -lglu32 -lgdi32 -lglfw3 main.cpp
Then, i tried to use the dynamic library, glfw.dll. I also linked the glfwdll.a library and defined the GLFW_DLL macro before including the headers.
g++ -L. libglfw3dll.a -lglfw3 -lopengl32 main.cpp
with the last option, i got just 1 undefined reference
undefined reference to `__imp_glClear'
I understand that this is from the opengl32 library.
I also understand that I'm missing something that I can't find.
Here I come again, can you give me a hand, and tell me what I'm missing?
Thanks!