🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

glfw "undefined reference to glfwInit"

Started by
2 comments, last by Quasimojo 12 years, 10 months ago
I had the following code (abbreviated for illustration purposes) building fine, except for the fact that it was unable to find glu.h:

#include <GL/glfw.h>

using namespace std;

int main()
{
int running = GL_TRUE;

if ( !glfwInit() )
{
exit(EXIT_FAILURE);
}

if (!glfwOpenWindow(900, 750, 0, 0, 0, 0, 0, 0, GLFW_WINDOW))
{
glfwTerminate();
exit(EXIT_FAILURE);
}

while (running)
{
// Game code
}

return 0;
}


After some digging, I was able to install the xorg devel package that set up glu.h. However, now I get glfw errors like 'undefined reference to glfwInit' and also for glfwOpenWindow and glfwTerminate.

The odd thing is that those methods are available in code completion lists for both the #include and the method calls. I've tried reinstalling the glfw and glfw-devel packages to no avail.

Any ideas?
Advertisement
"Undefined reference to" is an error from the linker. How are you compiling or linking the program? If you're doing it by hand on the command line or in your own Makefile, do you have "-lglfw" (dash, lower case "L", "glfw") somewhere in there?
I'm using Qt Creator, so it is handling the compiling and linking. Is there someplace I need to make the reference?
I found a way to add a reference to an external library (glfw) and that seemed to fix the problem. Now I need to do some digging into the subsequent issue - errors related to ATIFGLEXTENSION...

This topic is closed to new replies.

Advertisement