Results 1 to 6 of 6

Thread: How to link GLUT to Qt Project?

  1. #1
    Join Date
    Dec 2008
    Location
    Qt Reference Documentation
    Posts
    62
    Thanks
    25
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default 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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to link GLUT to Qt Project?

    Add the following line to your .pro file:
    qmake Code:
    1. LIBS+=-lglut32
    To copy to clipboard, switch view to plain text mode 

    If the library is not in your compiler's search path also add this line:
    qmake Code:
    1. LIBS+=-LpathToYourGLUTLib
    To copy to clipboard, switch view to plain text mode 

    Remember to rerun qmake afterwards.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2008
    Location
    Qt Reference Documentation
    Posts
    62
    Thanks
    25
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default 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:
    Qt Code:
    1. LIBS += -lglut32
    2. LIBS += -LC:\glut\glut.lib
    To copy to clipboard, switch view to plain text mode 

    I am getting tons of errors that look like:
    Qt Code:
    1. [..] glut.h:486: undefined reference to `__glutInitWithExit'
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to link GLUT to Qt Project?

    It should be:
    qmake Code:
    1. LIBS += -lglut32
    2. LIBS += -LC:\glut
    To copy to clipboard, switch view to plain text mode 

    But anyway also make sure your glut lib actually has that symbol exported which is missing.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Dec 2008
    Location
    Qt Reference Documentation
    Posts
    62
    Thanks
    25
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

  6. #6
    Join Date
    Mar 2010
    Location
    Trujillo-Peru
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Smile Re: How to link GLUT to Qt Project?

    I resolved the problem put:

    In the file main.cpp , add
    Qt Code:
    1. #include <QApplication>
    2. #include "window.h"
    3. #include <GL/glut.h>//add
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7.  
    8. glutInit(&argc, argv); //initialize glut
    9. QApplication app(argc, argv);
    10. Window window;
    11. window.show();
    12.  
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

    See you
    Last edited by wysota; 21st March 2010 at 01:13.

Similar Threads

  1. Translation tools problems
    By MarkoSan in forum Qt Tools
    Replies: 23
    Last Post: 22nd August 2010, 00:43
  2. How to Compile VTKDesigner2 with Qt?
    By alfredoaal in forum Newbie
    Replies: 0
    Last Post: 5th September 2008, 05:34
  3. Importing qt project to an eclipse workspace
    By isahin in forum Installation and Deployment
    Replies: 2
    Last Post: 28th January 2008, 18:00
  4. CMake and pthreads
    By Matt Smith in forum General Discussion
    Replies: 5
    Last Post: 3rd September 2006, 20:42
  5. Replies: 2
    Last Post: 11th July 2006, 14:19

Tags for this Thread

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.