Skip to main content
GameDev.net gamedev.net
🔒 Locked

glfw "undefined reference to glfwInit"

Started by Quasimojo Sep 1, 2011 at 1:14 AM 2 replies 17.5k views
Original Post
Quasimojo
Quasimojo
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?
Null and Void
Null and Void
"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?
Quasimojo
Quasimojo
I'm using Qt Creator, so it is handling the compiling and linking. Is there someplace I need to make the reference?
Quasimojo
Quasimojo
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...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.