XHotSniperX
XHotSniperX

Reputation: 722

Qt Creator - LNK1104: cannot open file "glu32.lib"

I am using Qt and Qt Creator and I want to run a test file to see if my Installation is correct or not. I use Windows 8.1 64 bit. I installed the newest Qt OpenGL 64 bit Version for Windows.

I already included the file glu32.lib by doing this in my .pro file:

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/C:/Program Files (x86)/Windows 

Kits/8.1/Lib/winv6.3/um/x64/ -lGlU32
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/C:/Program Files (x86)/Windows Kits/8.1/Lib/winv6.3/um/x64/ -lGlU32d

INCLUDEPATH += $$PWD/C:/Program Files (x86)/Windows Kits/8.1/Include/um/gl
DEPENDPATH += $$PWD/C:/Program Files (x86)/Windows Kits/8.1/Include/um/gl

That did not fix it. The file exists in that Folder. Can you help me please?

Upvotes: 2

Views: 8651

Answers (4)

remikz
remikz

Reputation: 436

I know the question is about the QtCreator IDE, but I got this error when compiling from the command line. I had to run vcvars32.bat to fix it. Everything compiled fine because the msvc compiler was already in PATH, but linking was the problem.

Upvotes: 0

matt
matt

Reputation: 1

When you make a project, at the kit selection, only select:

Desktop Qt 5.4.1 64bit

I had the same problem, then I made a new project without the 32 bit OpenGL Kit selected and it works fine for me. By default, Qt has both selected.

Upvotes: 0

YanShao
YanShao

Reputation: 31

Add

 QMAKE_LIBDIR += "glu32_location"

to your .pro file, then it works.

Upvotes: 1

László Papp
László Papp

Reputation: 53145

First of all, it is case sensitive.

Secondly, you do not need to add the debug marker explicitly, so just write this:

LIBS += glu32

rather than:

LIBS += Glu32d

Also, as Martin pointed out in a comment, you better double quote strings containing spaces as follows:

-L"$$PWD/C:/Program Files (x86)/Windows"

or this if you fancy:

-L$$quote($$PWD/C:/Program Files (x86)/Windows)

Furthermore, this does not make any sense as the second branch will never satisfy:

win32: ...
else: win32: ...

If you do not want to go editing the project file, you can use the QtCreator GUI to add a system library like glu:

enter image description here

Furthermore, you seem to have 64 bit Qt installed on Windows, but you are trying to use 32 bit glu. Do not do that. Use either 32 bit for both or 64 bit.

Upvotes: 2

Related Questions