zeboidlund
zeboidlund

Reputation: 10137

Linking freeglut with Qt Creator in Linux

I currently run Arch Linux on my laptop and was hoping to know why Qt Creator isn't finding my glut library (which exists on my system).

My setup qmake file looks as follows:

     ...
    /*sources and headers above*/

    QT += opengl

    LIBS += -lfreeglut

    INCLUDEPATH += -L/usr/lib/

And when I run a locate glut, I get the following:

/usr/include/kwinglutils.h
/usr/include/kwinglutils_funcs.h
/usr/include/GL/freeglut.h
/usr/include/GL/freeglut_ext.h
/usr/include/GL/freeglut_std.h
/usr/include/GL/glut.h
/usr/lib/libglut.a
/usr/lib/libglut.so
/usr/lib/libglut.so.3
/usr/lib/libglut.so.3.9.0
/usr/share/avogadro/fragments/amino_acids/D-glutamic_acid.cml
/usr/share/avogadro/fragments/amino_acids/D-glutamine.cml
/usr/share/avogadro/fragments/amino_acids/L-glutamic_acid.cml                                                                                                               
/usr/share/avogadro/fragments/amino_acids/L-glutamine.cml
/usr/share/licenses/freeglut
/usr/share/licenses/freeglut/LICENSE
/var/lib/pacman/local/freeglut-2.6.0-1
/var/lib/pacman/local/freeglut-2.6.0-1/changelog
/var/lib/pacman/local/freeglut-2.6.0-1/desc
/var/lib/pacman/local/freeglut-2.6.0-1/files

Note that I have tried -lglut32 in my qmake file as well.

What could I be missing here?

Upvotes: 1

Views: 6366

Answers (2)

zeboidlund
zeboidlund

Reputation: 10137

Oh, silly me. I just realized that the correct lib to add was just -lglut and not -lglut32. This is because there exists libglut.so, and not libglut32.so.

Upvotes: 1

Dave Kilian
Dave Kilian

Reputation: 1012

When you specify -lfoobar in your .pro file (or with gcc in general), you're directing the compiler to search for the library libfoobar.a. Judging from your locate output it looks like you want:

LIBS += -lglut

Upvotes: 4

Related Questions