PDA

View Full Version : How to link glut.h?



connect_qt
14th November 2011, 16:12
I'm currently doing a project using QT creator, which including openGL and parallel processing-windows thread.
I'm a totally newbie to QT and now I'm learning how to link openGL to my project through tutorial that found on web.
I found that I couldn't link glut.h to my project and once I compile everytime, this error will occured.

D:\Academic\QT\test-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\test\main.cpp:3: error: GL/glut.h: No such file or directory
D:\Academic\QT\test-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\test\main.cpp:-1: In function 'int qMain(int, char**)':
D:\Academic\QT\test-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\test\main.cpp:7: error: 'glutInit' was not declared in this scope

How I manage to solve this?
Thanks in advance.

I had already tried this solution --> http://www.qtcentre.org/threads/25929-How-to-link-GLUT-to-Qt-Project
But I still can't solve it.

ChrisW67
15th November 2011, 05:07
You link libraries not headers; glut.h is a header file, not a library. Your immediate problem is in compilation not linking.

You need to set INCLUDEPATH correctly so that the compiler can find a file "GL/glut.h" on one of the paths in INCLUDEPATH.

Once you have done that you need to set LIBS correctly so that the linker can find the library and link it to the resulting program/library.

It is all in the friendly manual

connect_qt
15th November 2011, 06:25
You link libraries not headers; glut.h is a header file, not a library. Your immediate problem is in compilation not linking.

You need to set INCLUDEPATH correctly so that the compiler can find a file "GL/glut.h" on one of the paths in INCLUDEPATH.

Once you have done that you need to set LIBS correctly so that the linker can find the library and link it to the resulting program/library.

It is all in the friendly manual


Thanks. =)
I found my problem already.
The include inside mingw missed out glut.h file.
Copy & paste it and it solved. Thanks!

ChrisW67
15th November 2011, 22:14
This has nothing to do with MingW and its header files. If you have edited these then you will regret it later.