View Full Version : How to link GLUT to Qt Project?
Lawand
22nd November 2009, 19:36
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?
wysota
22nd November 2009, 19:41
Add the following line to your .pro file:
LIBS+=-lglut32
If the library is not in your compiler's search path also add this line:
LIBS+=-LpathToYourGLUTLib
Remember to rerun qmake afterwards.
Lawand
22nd November 2009, 19:53
It didn't work...
I have glut.lib file in the directory "C:\glut", and I added these two lines:
LIBS += -lglut32
LIBS += -LC:\glut\glut.lib
I am getting tons of errors that look like:
[..] glut.h:486: undefined reference to `__glutInitWithExit'
wysota
22nd November 2009, 22:44
It should be:
LIBS += -lglut32
LIBS += -LC:\glut
But anyway also make sure your glut lib actually has that symbol exported which is missing.
Lawand
23rd November 2009, 17:21
I did exactly as you said but I kept getting error messages, until I found this page (http://oldwiki.mingw.org/index.php/Glut), now my problem is solved.
Thanks alot, wysota for all your help :)
marx8926
20th March 2010, 20:29
I resolved the problem put:
In the file main.cpp , add
#include <QApplication>
#include "window.h"
#include <GL/glut.h>//add
int main(int argc, char *argv[])
{
glutInit(&argc, argv); //initialize glut
QApplication app(argc, argv);
Window window;
window.show();
return app.exec();
}
See you
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.