MinGW can't find my libraries
Hi,
I'm trying to compile qxmpp libraries with qtcreator 2.3.0. I believe the problem occurs at the linking stage, here is the relative output:
Code:
g++ -Wl,-s -Wl,-subsystem,console -o release\tests.exe release/tests.o release/moc_tests.o release/qrc_tests.o -L"c:\qt-everywhere-opensource-src-4.7.4\lib" -LE:/qxmpp-0.3.0/lib -lqxmpp -lQtTest -lQtXml -lQtGui -lQtNetwork -lQtCore gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib msimg32.lib c:\qt-everywhere-opensource-src-4.7.4\lib\QtCore.lib kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib /LIBPATH:C:\OpenSSL-Win32\lib
mingw32-make[2]: Leaving directory `E:/qxmpp-build-desktop-Qt_4_7_4__qt-everywhere-opensource-src-4_7_4__Release/tests'
mingw32-make[1]: Leaving directory `E:/qxmpp-build-desktop-Qt_4_7_4__qt-everywhere-opensource-src-4_7_4__Release/tests'
g++: gdi32.lib: No such file or directory
g++: comdlg32.lib: No such file or directory
g++: oleaut32.lib: No such file or directory
g++: imm32.lib: No such file or directory
g++: winmm.lib: No such file or directory
g++: winspool.lib: No such file or directory
g++: msimg32.lib: No such file or directory
g++: kernel32.lib: No such file or directory
g++: user32.lib: No such file or directory
g++: shell32.lib: No such file or directory
g++: uuid.lib: No such file or directory
g++: ole32.lib: No such file or directory
g++: advapi32.lib: No such file or directory
g++: ws2_32.lib: No such file or directory
g++: /LIBPATH:C:\OpenSSL-Win32\lib: No such file or directory
mingw32-make[2]: *** [release\tests.exe] Error 1
mingw32-make[1]: *** [release] Error 2
mingw32-make: *** [sub-tests-make_default-ordered] Error 2
The process "C:\Qt\qtcreator-2.3.0\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project qxmpp (target: Desktop)
When executing build step 'Make'
I copied the Microsoft SDK lib files to the qt's lib directory but it still can't find them. It also can't find the openssl libraries even though the path seen after LIBPATH is correct.
Any suggestions?
Thanks...
Re: MinGW can't find my libraries
How do you add gdi32 in .pro file?
Re: MinGW can't find my libraries
Quote:
Originally Posted by
llev
How do you add gdi32 in .pro file?
Thanks for answering, I tried these:
LIBS += "C:/Program Files/Microsoft SDKs/Windows/v7.0A/Lib"
LIBS += -L"C:/Program Files/Microsoft SDKs/Windows/v7.0A/Lib" -gdi32
LIBS += "C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0A\\Lib"
None of them worked. Do I have to explicitly add them in the pro file? Shouldn't QtCreator find them itself?
Re: MinGW can't find my libraries
Try to replace it with the lines like this:
Quote:
LIBS += -lgdi32 -lcomdlg32
etc.
Then rebuild the project and check how linker errors changed.
Re: MinGW can't find my libraries
Didn't work. Tried
Code:
LIBS += -lgdi32 ...
and
Code:
LIBS += +Lc:\\lib #ms sdk lib files are here
LIBS += -lgdi32 ...
.
It still can't find them.
Re: MinGW can't find my libraries
Please pay attention on how qt was built.
qt built using MinGW tools uses its own versions of standard libraries. They usually locate at lib sub-folder of MinGW root folder.
Also MinGW tools treat "-lgdi32" record as request to link libgdi32.a file, by other words they follow linux-style naming convention.
And, of course, qt built with MinGW should be used with MinGW build tools.
As I understand you're using MinGW build tools.
Correct?
I guess qt you're using was built with MinGW too?
If so, try to add the path to MinGW\lib folder via the line similar to the following:
Quote:
QMAKE_LIBDIR += C:/MinGW/lib
And get back to LIBS += -lgdi32 ..
Re: MinGW can't find my libraries
Actually I didn't have a lib folder under C:\mingw, but anyway I tried compiling the project with msvc2010 (again with qtcreator) and it compiled fine! Is there any particular reason as to why I should use mingw? Because msvc seems to be giving me less problems. I'll consider what you said when I try with mingw next.
Re: MinGW can't find my libraries
I prefer to use MSVC libs and see a few reasons to use MinGW on Windows' builds.
I told you about MinGW just because the logs in your original post show that fact you used MinGW tools to compile app.
Quote:
g++ -Wl,-s -Wl,-subsystem,console -o release\tests.exe release/tests.o release/moc_tests.o release/qrc_tests.o -L"c:\qt-everywhere-opensource-src-4.7.4\lib" -LE:/qxmpp-0.3.0/lib -lqxmpp -lQtTest -lQtXml -lQtGui -lQtNetwork -lQtCore gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib msimg32.lib c:\qt-everywhere-opensource-src-4.7.4\lib\QtCore.lib kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib /LIBPATH:C:\OpenSSL-Win32\lib
mingw32-make[2]: Leaving directory `E:/qxmpp-build-desktop-Qt_4_7_4__qt-everywhere-opensource-src-4_7_4__Release/tests'
mingw32-make[1]: Leaving directory `E:/qxmpp-build-desktop-Qt_4_7_4__qt-everywhere-opensource-src-4_7_4__Release/tests'
g++: gdi32.lib: No such file or directory
Re: MinGW can't find my libraries
Yes I was, switched to msvc later as I said. Thanks for helping.