PDA

View Full Version : Cannot run example from Welcome Page



rox_rook
26th October 2010, 18:12
Hi,

I've installed the newest SDK ( 2010.05 ), SDK 4.7.0 on Windows Server 2003. Then I launched Qt Creator to run some existing examples, but the compiler gave me a bunch of building errors:


C:\Qt\2010.05\qt\examples\opengl\2dpainting-build-desktop/tmp/moc/debug_shared//../../../../2dpainting/window.h:55: undefined reference to `_imp___ZN7QWidgetD2Ev'

c:/qt/2010.05/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]: *** [debug\2dpainting.exe] Error 1

mingw32-make: *** [debug-all] Error 2

The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project 2dpainting (target: Desktop)
When executing build step 'Make'

I did the same thing at home on Windows 7 and it worked. What's wrong? Any idea?

Regard,
Chan Nguyen

wysota
26th October 2010, 18:57
I doubt we'll be able to help without you providing detailed information on what you did to obtain this error.

rox_rook
26th October 2010, 19:55
Hi there,

I think I provided a detailed information above. I downloaded the SDK 4.7 version from Qt4 site, and run the installation wizard. Then I opened existing examples from Qt Creator, and click "Build". That's all.

Thanks,
Chan Nguyen

Zlatomir
26th October 2010, 21:00
All the examples fail to compile? Or just 2dpainting?

If all fail, look in Compile Output (in the Output panel switch from Build issues) and it might contain a "better" error message on why they don't compile.

If only 2dpainting doesn't compile it might need some library that is not present in 2003 Server (i know that 2003 Server has the D3D and DDraw acceleration disabled by default, it might be that OpenGl is missing, they don't expect to run that kind of software on a server os)

rox_rook
27th October 2010, 15:47
Hi Zlatomir,

Some of examples failed, not all.
Here is my "Compile Output" for draggabletext:


Running build steps for project draggabletext...
Starting: "c:/qt/2010.05/qt/bin/qmake.exe" C:/Qt/2010.05/qt/examples/draganddrop/draggabletext/draggabletext.pro -r -spec win32-g++
The process "c:/qt/2010.05/qt/bin/qmake.exe" exited normally.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Qt/2010.05/qt/examples/draganddrop/draggabletext-build-desktop'

C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug all

mingw32-make[1]: Entering directory `C:/Qt/2010.05/qt/examples/draganddrop/draggabletext-build-desktop'

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\draggabletext" -I"." -I"..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\draglabel.o ..\draggabletext\draglabel.cpp

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\draggabletext" -I"." -I"..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\dragwidget.o ..\draggabletext\dragwidget.cpp

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\draggabletext" -I"." -I"..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\main.o ..\draggabletext\main.cpp

c:\Qt\2010.05\qt\bin\rcc.exe -name draggabletext ..\draggabletext\draggabletext.qrc -o tmp\rcc\debug_shared\qrc_draggabletext.cpp

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\draggabletext" -I"." -I"..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\qrc_draggabletext.o tmp\rcc\debug_shared\qrc_draggabletext.cpp

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\draggabletext.exe tmp/obj/debug_shared/draglabel.o tmp/obj/debug_shared/dragwidget.o tmp/obj/debug_shared/main.o tmp/obj/debug_shared/qrc_draggabletext.o -L"c:\Qt\2010.05\qt\lib" -L"c:\Program Files\SQLXML 4.0\bin\" -L"c:\Qt\2010.05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4

mingw32-make[1]: Leaving directory `C:/Qt/2010.05/qt/examples/draganddrop/draggabletext-build-desktop'

mingw32-make: Leaving directory `C:/Qt/2010.05/qt/examples/draganddrop/draggabletext-build-desktop'

tmp/obj/debug_shared/draglabel.o: In function `DragLabel':

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/draglabel.cpp:46: undefined reference to `_imp___ZN6QLabelC2ERK7QStringP7QWidget6QFlagsIN2Q t10WindowTypeEE'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/draglabel.cpp:48: undefined reference to `_imp___ZN7QWidget21setAutoFillBackgroundEb'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/draglabel.cpp:49: undefined reference to `_imp___ZN6QFrame13setFrameShapeENS_5ShapeE'

..............................
tmp/obj/debug_shared/dragwidget.o: In function `DragWidget':

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:47: undefined reference to `_imp___ZN7QWidgetC2EPS_6QFlagsIN2Qt10WindowTypeEE '

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:49: undefined reference to `_imp___ZN5QFileC1ERK7QString'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:50: undefined reference to `_imp___ZN5QFile4openE6QFlagsIN9QIODevice12OpenMod eFlagEE'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:51: undefined reference to `_imp___ZN11QTextStreamC1EP9QIODevice'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:58: undefined reference to `_imp___ZN11QTextStreamrsER7QString'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:63: undefined reference to `_imp___ZN7QWidget12setAttributeEN2Qt15WidgetAttri buteEb'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:56: undefined reference to `_imp___ZNK11QTextStream5atEndEv'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:72: undefined reference to `_imp___ZNK7QWidget7paletteEv'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:72: undefined reference to `_imp___ZN8QPaletteC1ERKS_'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:73: undefined reference to `_imp___ZN6QColorC1EN2Qt11GlobalColorE'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:74: undefined reference to `_imp___ZN7QWidget10setPaletteERK8QPalette'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:76: undefined reference to `_imp___ZN7QWidget14setAcceptDropsEb'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:77: undefined reference to `_imp___ZN7QWidget14setMinimumSizeEii'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:78: undefined reference to `_imp___ZN7QWidget14setWindowTitleERK7QString'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:78: undefined reference to `_imp___ZN8QPaletteD1Ev'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:78: undefined reference to `_imp___ZN8QPaletteD1Ev'

C:\Qt\2010.05\qt\examples\draganddrop\draggabletex t-build-desktop/../draggabletext/dragwidget.cpp:78: undefined reference to `_imp___ZN11QTextStreamD1Ev'


..................
c:/qt/2010.05/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]: *** [debug\draggabletext.exe] Error 1

mingw32-make: *** [debug-all] Error 2

The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project draggabletext (target: Desktop)
When executing build step 'Make'
Can you help?

Thanks,
Chan Nguyen

hickej
18th December 2010, 16:00
I have the exact same issue. I installed the latest (qt-sdk-win-opensource-2010.05.exe) on a dell laptop at work and all samples work fine. I installed the same thing at home on another dell laptop and all the samples that I've tried have unresolved references (see below). I have tried manipulating the PATH, INCLUDE, LIB and I cleared out my tmp directories with no good result. The same simple sequence of a fresh install on two different machines; one machine works, the other doesn't. I've been comparing the environment settings between the two machines but that does not seem to be the issue. I'm at my wit's end...

My suspicion is that the following argument to g++ is the culprit but I can't seem to make it go away by manipulating anything in the Build Environment settings.
-L"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\"

Any insight into how Qt looks for libraries would be appreciated.

The sample (Address Book Part 1) compiles, but doesn't link.

Compile Output
----------------------------------------------------------------
Running build steps for project part1...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Qt/2010.05/qt/examples/tutorials/addressbook/part1-build-desktop'

C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug all

mingw32-make[1]: Entering directory `C:/Qt/2010.05/qt/examples/tutorials/addressbook/part1-build-desktop'

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtGui" -I"..\..\..\..\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\part1" -I"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include" -I"." -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\addressbook.o ..\part1\addressbook.cpp

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtGui" -I"..\..\..\..\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\part1" -I"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include" -I"." -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\main.o ..\part1\main.cpp

C:\Qt\2010.05\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtGui" -I"..\..\..\..\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\part1" -I"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include" -I"." -I"..\..\..\..\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\part1\addressbook.h -o tmp\moc\debug_shared\moc_addressbook.cpp

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtGui" -I"..\..\..\..\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\part1" -I"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include" -I"." -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\moc_addressbook.o tmp\moc\debug_shared\moc_addressbook.cpp

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

mingw32-make[1]: Leaving directory `C:/Qt/2010.05/qt/examples/tutorials/addressbook/part1-build-desktop'

mingw32-make: Leaving directory `C:/Qt/2010.05/qt/examples/tutorials/addressbook/part1-build-desktop'

tmp/obj/debug_shared/addressbook.o: In function `AddressBook':

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:46: undefined reference to `_imp___ZN7QWidgetC2EPS_6QFlagsIN2Qt10WindowTypeEE '

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:48: undefined reference to `_imp___ZN6QLabelC1ERK7QStringP7QWidget6QFlagsIN2Q t10WindowTypeEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:49: undefined reference to `_imp___ZN9QLineEditC1EP7QWidget'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:51: undefined reference to `_imp___ZN6QLabelC1ERK7QStringP7QWidget6QFlagsIN2Q t10WindowTypeEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:52: undefined reference to `_imp___ZN9QTextEditC1EP7QWidget'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:56: undefined reference to `_imp___ZN11QGridLayoutC1Ev'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:57: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetii6QFla gsIN2Qt13AlignmentFlagEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:58: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetii6QFla gsIN2Qt13AlignmentFlagEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:59: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetii6QFla gsIN2Qt13AlignmentFlagEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:60: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetii6QFla gsIN2Qt13AlignmentFlagEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:64: undefined reference to `_imp___ZN7QWidget9setLayoutEP7QLayout'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:65: undefined reference to `_imp___ZN7QWidget14setWindowTitleERK7QString'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:66: undefined reference to `_imp___ZN7QWidgetD2Ev'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:46: undefined reference to `_imp___ZN7QWidgetC2EPS_6QFlagsIN2Qt10WindowTypeEE '

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:48: undefined reference to `_imp___ZN6QLabelC1ERK7QStringP7QWidget6QFlagsIN2Q t10WindowTypeEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:49: undefined reference to `_imp___ZN9QLineEditC1EP7QWidget'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:51: undefined reference to `_imp___ZN6QLabelC1ERK7QStringP7QWidget6QFlagsIN2Q t10WindowTypeEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:52: undefined reference to `_imp___ZN9QTextEditC1EP7QWidget'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:56: undefined reference to `_imp___ZN11QGridLayoutC1Ev'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:57: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetii6QFla gsIN2Qt13AlignmentFlagEE'

C:\Qt\2010.05\qt\examples\tutorials\addressbook\pa rt1-build-desktop/../part1/addressbook.cpp:58: undefined reference to `_imp___ZN11QGridLayout9addWidgetEP7QWidgetii6QFla gsIN2Qt13AlignmentFlagEE'


etc.....


collect2: ld returned 1 exit status

mingw32-make[1]: *** [debug\part1.exe] Error 1

mingw32-make: *** [debug-all] Error 2

The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project part1 (target: Desktop)
When executing build step 'Make'

hickej
18th December 2010, 18:46
Not one to give up, I've isolated the issue on my particular setup. I edited the LIB and PATH in 'Projects' to remove references to .NET but that wasn't enough. To effect the change I also had to delete the part1-build-desktop directory and then rebuild. Something was hanging on to the .NET library. Next step is to figure out how to get this to work without breaking Visual Studio and without having to edit every project's 'Projects' settings. For now, I've edited my system environment variables to eliminate the .NET libraries and I can now build the sample programs.