A .lib problem when using QtCreator 2.3.1, Qt 4.7.4, and mingw32....
-
Hi,
I am new to Qt but have developed before with C++. Appreciate your input since I have been trying to solve this issue for a while with no progress.
I have a .lib library (deviceusb.lib) that was compiled using gcc and works fine from a command line windows program that was also built using gcc and statically linked to the that .lib.
When trying to use the library from a GUI app in Qt, I get an ambiguous error saying:
mingw32-make[1]: *** [debug\exer.exe] Error 1
mingw32-make: *** [debug] Error 2
The process "D:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project exer (target: Desktop)
When executing build step 'Make'Best Regards,
WasHere are the source code, .pro and output trace:
@
#include <QtGui/QApplication>
#include "mainwindow.h"#include "libdeviceusb.h"
int main(int argc, char *argv[])
{
device_Init(NULL, NULL, NULL);QApplication a(argc, argv); MainWindow w; w.show(); a.exec(); device_Fini(); return 0;
}@
@
QT += core guiTARGET = exer
TEMPLATE = appSOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
win32: LIBS += -L$$PWD/../deviceusb/lib/ -ldeviceusb
INCLUDEPATH += $$PWD/../deviceusb/src/include
DEPENDPATH += $$PWD/../deviceusb/src/includewin32: PRE_TARGETDEPS += $$PWD/../deviceusb/lib/deviceusb.lib
Running build steps for project exer...
Starting: "D:\QtSDK\mingw\bin\mingw32-make.exe" clean
D:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug clean
mingw32-make[1]: Entering directoryD:/systemt/exer-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug' del debug\moc_mainwindow.cpp del debug\main.o debug\mainwindow.o debug\moc_mainwindow.o mingw32-make[1]: Leaving directory
D:/systemt/exer-build-desktop-Qt_4_7_4_for_Desktop_-MinGW_4_4__Qt_SDK__Debug'
D:/QtSDK/mingw/bin/mingw32-make -f Makefile.Release clean
mingw32-make[1]: Entering directoryD:/systemt/exer-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug' del release\moc_mainwindow.cpp del release\main.o release\mainwindow.o release\moc_mainwindow.o mingw32-make[1]: [compiler_moc_header_clean] Error 1 (ignored) mingw32-make[1]: Leaving directory
D:/systemt/exer-build-desktop-Qt_4_7_4_for_Desktop-MinGW_4_4__Qt_SDK__Debug'
mingw32-make[1]: [clean] Error 1 (ignored)
The process "D:\QtSDK\mingw\bin\mingw32-make.exe" exited normally.
Configuration unchanged, skipping qmake step.
Starting: "D:\QtSDK\mingw\bin\mingw32-make.exe"
D:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directoryD:/systemt/exer-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"..\deviceusb\src\include" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"..\exer" -I"." -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -o debug\main.o ..\exer\main.cpp g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"..\deviceusb\src\include" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"..\exer" -I"." -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -o debug\mainwindow.o ..\exer\mainwindow.cpp D:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"..\deviceusb\src\include" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"..\exer" -I"." -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\exer\mainwindow.h -o debug\moc_mainwindow.cpp g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtGui" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"..\deviceusb\src\include" -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\ActiveQt" -I"debug" -I"..\exer" -I"." -I"..\..\QtSDK\Desktop\Qt\4.7.4\mingw\mkspecs\win32-g++" -o debug\moc_mainwindow.o debug\moc_mainwindow.cpp g++ -mthreads -Wl,-subsystem,windows -o debug\exer.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -L"d:\QtSDK\Desktop\Qt\4.7.4\mingw\lib" -lmingw32 -lqtmaind -LD:/systemt/exer/../deviceusb/lib/ -ldeviceusb -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib mingw32-make[1]: Leaving directory
D:/systemt/exer-build-desktop-Qt_4_7_4_for_Desktop-_MinGW_4_4__Qt_SDK__Debug'
mingw32-make[1]: *** [debug\exer.exe] Error 1
mingw32-make: *** [debug] Error 2
The process "D:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project exer (target: Desktop)
When executing build step 'Make'
@[edit] code tags added, koahnig