PDA

View Full Version : Demo projects not compiling



vaibhavsri
24th May 2010, 12:17
I am a newbie

- i installed QT's LGPL version
- i have QT creator version 1.3.1 based on Qt 4.6.2
- ming version shown is 4.4


When I try to load and build any demo projects, I get this kind of errors (hundreds of them)....any help would be appreciated

D:\Qt\qt\examples\dialogs\licensewizard/licensewizard.cpp:51: undefined reference to `_imp___ZN7QWizard7setPageEiP11QWizardPage'


d:/qt/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../libmingw32.a(main.o):main.c::-1: error: undefined reference to `WinMain@16'

TwoBit
28th May 2010, 04:01
I am having the same problem. Qt 4.6.2 samples don't build.
I can't find any help in the documentation. The "c:\Qt\2010.02.1\qt\lib" used in the command line exists and is populated. The libraries specified by -l (e.g. libQtCored4.a) exist.

I get the same errors when manually running the link on the command line:

C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n>C:\Qt\2010.02.1\mingw\bin\g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\application.exe tmp/obj/debug_shared/main.o tmp/obj/debug_shared/mainwindow.o tmp/obj/debug_shared/moc_mainwindow.o tmp/obj/debug_shared/qrc_application.o -L"c:\Qt\2010.02.1\qt\lib" -L"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\" -L"c:\Qt\2010.02.1\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4


Error Output:
-----------------------------
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\application.exe tmp/obj/debug_shared/main.o tmp/obj/debug_shared/mainwindow.o tmp/obj/debug_shared/moc_mainwindow.o tmp/obj/debug_shared/qrc_application.o -L"c:\Qt\2010.02.1\qt\lib" -L"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\" -L"c:\Qt\2010.02.1\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4

tmp/obj/debug_shared/main.o: In function `Z5qMainiPPc':
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/main.cpp:51: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/main.cpp:52: undefined reference to `_imp___ZN16QCoreApplication19setOrganizationNameE RK7QString'
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/main.cpp:53: undefined reference to `_imp___ZN16QCoreApplication18setApplicationNameER K7QString'
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/main.cpp:56: undefined reference to `_imp___ZN12QApplication4execEv'
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/main.cpp:56: undefined reference to `_imp___ZN12QApplicationD1Ev'
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/main.cpp:56: undefined reference to `_imp___ZN12QApplicationD1Ev'
tmp/obj/debug_shared/main.o: In function `QString':
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/../../../include/QtCore/../../src/corelib/tools/qstring.h:413: undefined reference to `_imp___ZN7QString16fromAscii_helperEPKci'
tmp/obj/debug_shared/main.o: In function `~QString':
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/../../../include/QtCore/../../src/corelib/tools/qstring.h:869: undefined reference to `_imp___ZN7QString4freeEPNS_4DataE'
tmp/obj/debug_shared/main.o: In function `~MainWindow':
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/mainwindow.h:55: undefined reference to `_imp___ZN11QMainWindowD2Ev'
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/mainwindow.h:55: undefined reference to `_imp___ZN11QMainWindowD2Ev'
.
<thousands of similar errors>
.
tmp/obj/debug_shared/qrc_application.o: In function `Z29qCleanupResources_applicationv':
C:\Qt\2010.02.1\qt\examples\mainwindows\applicatio n/tmp/rcc/debug_shared/qrc_application.cpp:645: undefined reference to `_imp___Z23qUnregisterResourceDataiPKhS0_S0_'
c:/qt/2010.02.1/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
mingw32-make[1]: Leaving directory `C:/Qt/2010.02.1/qt/examples/mainwindows/application'
mingw32-make: Leaving directory `C:/Qt/2010.02.1/qt/examples/mainwindows/application'
mingw32-make[1]: *** [debug\application.exe] Error 1
mingw32-make: *** [debug-all] Error 2
Exited with code 2.
Error while building project application
When executing build step 'Make'
-----------------------------

TwoBit
28th May 2010, 04:23
I figured out the cause. It looks like a bug in QtCreator or the Qt config process in how it handles the Microsoft LIB environment variable. GCC is choking on this:

-L"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\"

because it ends in a trailing backslash and that somehow confuses it. Qt copies that Microsoft environment variable to the linker command line without removing the trailing backslash. I tend to think that's a bug.

To fix it you need to modify your environment variable yourself in your Windows settings or you need to somehow fix the QT install. How? Edit a config file somewhere?