How to link GLUT to Qt Project?
I am not new to Qt 4, but when it comes to library files, you can call me a newbie :)
I have a project that uses OpenGL and GLUT, I want to compile it in Qt Creator and I don't know how to add GLUT and link to it..
FWIW, I am working on a Windows XP machine, and I have these files:
glut.h
glut.def
glut32.lib
glut32.dll
what should I add and how?
Re: How to link GLUT to Qt Project?
Add the following line to your .pro file:
If the library is not in your compiler's search path also add this line:
Code:
LIBS+=-LpathToYourGLUTLib
Remember to rerun qmake afterwards.
Re: How to link GLUT to Qt Project?
It didn't work...
I have glut.lib file in the directory "C:\glut", and I added these two lines:
Code:
LIBS += -lglut32
LIBS += -LC:\glut\glut.lib
I am getting tons of errors that look like:
Code:
[..] glut.h:486: undefined reference to `__glutInitWithExit'
Re: How to link GLUT to Qt Project?
It should be:
Code:
LIBS += -lglut32
LIBS += -LC:\glut
But anyway also make sure your glut lib actually has that symbol exported which is missing.
Re: How to link GLUT to Qt Project?
I did exactly as you said but I kept getting error messages, until I found this page, now my problem is solved.
Thanks alot, wysota for all your help :)
Re: How to link GLUT to Qt Project?
I resolved the problem put:
In the file main.cpp , add
Code:
#include <QApplication>
#include "window.h"
#include <GL/glut.h>//add
int main(int argc, char *argv[])
{
glutInit(&argc, argv); //initialize glut
Window window;
window.show();
return app.exec();
}
See you