Results 1 to 4 of 4

Thread: How to link glut.h?

  1. #1
    Join Date
    Nov 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default How to link glut.h?

    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/2592...-to-Qt-Project
    But I still can't solve it.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to link glut.h?

    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

  3. #3
    Join Date
    Nov 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to link glut.h?

    Quote Originally Posted by ChrisW67 View Post
    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!

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to link glut.h?

    This has nothing to do with MingW and its header files. If you have edited these then you will regret it later.

Similar Threads

  1. Linking GLUT with QT
    By TheBogeyMan in forum Newbie
    Replies: 1
    Last Post: 10th October 2011, 18:41
  2. Replies: 11
    Last Post: 5th May 2011, 14:05
  3. Qi with glut
    By hudi in forum Qt Programming
    Replies: 7
    Last Post: 14th April 2010, 11:41
  4. How to link GLUT to Qt Project?
    By Lawand in forum Newbie
    Replies: 5
    Last Post: 20th March 2010, 20:29
  5. using GLUT along with qtcreator/mingw in windows
    By stephanepoirier in forum Qt Programming
    Replies: 1
    Last Post: 3rd March 2009, 05:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.