Why is this so hard. (Building examples)
Hi guys and Ladies. Really want to learn QT. But why so hard to get going.
Installed QT 4.6.2 binary, open source. Next -> Next -> Next etc on my Windows XP.
Start Creator. Choose sample "Application". Choose Build.
Now shouldn't this just work out of the box. Oh no. I get all the errors described below (shortened).
I really don't want to proceed if I can't resolve this issue which shouldn't be there in the first place (think its important to get a good start, things can soon enough get difficult).
Been sweeping the net for a couple of hours now without getting anything.
Somebody got some pointers in the right direction please. Don't want to quit just yet, but I feel it's up hill right now. Please please.
(already added som dirs to global path).
B.R. Ohlfsen
Running build steps for project application...
Configuration unchanged, skipping QMake step.
Starting: C:/Qt/2010_02_1/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `C:/Qt/2010_02_1/qt/examples/mainwindows/application'
C:/Qt/2010_02_1/mingw/bin/mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/2010_02_1/qt/examples/mainwindows/application'
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:\Programmer\SQLXML 4.0\bin\" -L"c:\Qt\2010_02_1\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
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'
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'
tmp/obj/debug_shared/mainwindow.o: In function `MainWindow':
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/mainwindow.cpp:49: undefined reference to `_imp___ZN11QMainWindowC2EP7QWidget6QFlagsIN2Qt10W indowTypeEE'
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/mainwindow.cpp:52: undefined reference to `_imp___ZN14QPlainTextEditC1EP7QWidget'
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/mainwindow.cpp:53: undefined reference to `_imp___ZN11QMainWindow16setCentralWidgetEP7QWidge t'
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/mainwindow.cpp:63: undefined reference to `_imp___Z13qFlagLocationPKc'
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/mainwindow.cpp:63: undefined reference to `_imp___Z13qFlagLocationPKc'
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/mainwindow.cpp:63: undefined reference to `_imp___ZNK14QPlainTextEdit8documentEv'
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/mainwindow.cpp:63: undefined reference to `_imp___ZN7QObject7connectEPKS_PKcS1_S3_N2Qt14Conn ectionTypeE'
undefined reference to `QWidget::changeEvent(QEvent*)'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xc0): undefined reference to `QWidget::metric(QPaintDevice::PaintDeviceMetric) const'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xc4): undefined reference to `QWidget::inputMethodEvent(QInputMethodEvent*)'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xc8): undefined reference to `QWidget::inputMethodQuery(Qt::InputMethodQuery) const'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xcc): undefined reference to `QWidget::focusNextPrevChild(bool)'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xd0): undefined reference to `QWidget::styleChange(QStyle&)'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xd4): undefined reference to `QWidget::enabledChange(bool)'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xd8): undefined reference to `QWidget::paletteChange(QPalette const&)'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xdc): undefined reference to `QWidget::fontChange(QFont const&)'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xe0): undefined reference to `QWidget::windowActivationChange(bool)'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xe4): undefined reference to `QWidget::languageChange()'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xe8): undefined reference to `QMainWindow::createPopupMenu()'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0xfc): undefined reference to `non-virtual thunk to QWidget::devType() const'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0x100): undefined reference to `non-virtual thunk to QWidget::paintEngine() const'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0x104): undefined reference to `non-virtual thunk to QWidget::getDC() const'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0x108): undefined reference to `non-virtual thunk to QWidget::releaseDC(HDC__*) const'
tmp/obj/debug_shared/moc_mainwindow.o:moc_mainwindow.cpp:(.rdata$_ZTV10 MainWindow[vtable for MainWindow]+0x10c): undefined reference to `non-virtual thunk to QWidget::metric(QPaintDevice::PaintDeviceMetric) const'
tmp/obj/debug_shared/moc_mainwindow.o: In function `~MainWindow':
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/tmp/moc/debug_shared//../../../mainwindow.h:55: undefined reference to `_imp___ZN11QMainWindowD2Ev'
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/tmp/moc/debug_shared//../../../mainwindow.h:55: undefined reference to `_imp___ZN11QMainWindowD2Ev'
tmp/obj/debug_shared/qrc_application.o: In function `Z26qInitResources_applicationv':
C:\Qt\2010_02_1\qt\examples\mainwindows\applicatio n/tmp/rcc/debug_shared/qrc_application.cpp:636: undefined reference to `_imp___Z21qRegisterResourceDataiPKhS0_S0_'
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]: *** [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'
Re: Why is this so hard. (Building examples)
can you show us your current path?
Also, start the Qt Command Prompt and paste what is printed to the console.
Re: Why is this so hard. (Building examples)
What is "c:\Programmer\SQLXML 4.0\bin"? How did it end up in your linker path?
Re: Why is this so hard. (Building examples)
Wow. Thanks for your swift replies.
The path taken from Projekt->Run settings->Run environment is
C:\Qt\2010_02_1\qt\bin;C:\Programmer\PC Connectivity Solution\;C:\Programmer\RSA SecurID Token Common;C:\Programmer\ThinkPad\Utilities;C:\WINDOWS \system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\P rogrammer\ZipGenius 6\;C:\Programmer\ATI Technologies\ATI.ACE\Core-Static;C:\Programmer\Fælles filer\Lenovo;C:\Programmer\Intel\Wireless\Bin\;C:\ Programmer\Microsoft SQL Server\80\Tools\Binn\;C:\Programmer\Microsoft SQL Server\90\DTS\Binn\;C:\Programmer\Microsoft SQL Server\90\Tools\binn\;C:\Programmer\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Progr ammer\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Programmer\jZi p;C:\Programmer\ThinkPad\ConnectUtilities;C:\Progr ammer\Bazaar;C:\Programmer\Java\jre1.6.0_07\bin\cl ient;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 ;C:\Programmer\Global Refund\Shop Assistant;C:\Programmer\OPOS\Epson2;c:\python26;C: \Programmer\IronPython 2.0.1;c:\progs\cmd;C:\Programmer\TortoiseSVN\bin;C :\Qt\2010_02_1\qt\bin;C:\Qt\2010_02_1\bin;C:\Qt\20 10_02_1\mingw\bin
The path from the QT command prompt is
C:\Qt\2010_02_1\qt\bin;C:\Qt\2010_02_1\bin;C:\Qt\2 010_02_1\mingw\bin;C:\WINDOWS\System32
The "c:\Programmer\SQLXML 4.0\bin" is in an environment variable called LIB. I didn't put it there, and don't know what it's for. It's the only entry in the LIB environment variable.
Re: Why is this so hard. (Building examples)
I don't have such entry in my examples/mainwindows/application project file. Are you sure you didn't change any files? What exactly did you do to download, install Qt and build the example?
Re: Why is this so hard. (Building examples)
I'm not an expert but one other thing you could try is to build the app from the Qt command prompt - at least that will give you a 'clean' environment and path.
There are these weird spaces in the path and also in the build log - is it a non-english OS (although that shouldn't matter).
I also noticed visual studio 8 is in the path. I would put all Qt related entries at the front of the path, not at the end. Of course this won't matter if you build from the Qt command prompt.
Re: Why is this so hard. (Building examples)
I had a similar problem to yours. (here)
My solution was to move the entire examples directory from its location under C:\Nokia\Qt\2009.05\qt\examples to C:\Nokia\Qt\examples and then just open the examples like I would any other project. You could probably move this directory almost anywhere.
Does this work-around work for you?
Re: Why is this so hard. (Building examples)
Is that a space in the MinGW path?
[edit]Oh, typo.
Re: Why is this so hard. (Building examples)
Thank you all for your interest and your help. Really appreciate it.
The advice from Tvt204 did the trick. Weird but it works. Thanks Tvt204.
By the way c:\Programmer\SQLXML 4.0\bin has to do with my Microsoft SQL server installation and then strange character in my path not easily identifyable is an underscore _.
Kindest regards
Ohlfsen
Re: Why is this so hard. (Building examples)
Quote:
Originally Posted by
ohlfsen
The advice from Tvt204 did the trick. Weird but it works. Thanks Tvt204.
You wouldn't have to do that if you explicitely ran qmake in the example directory prior to starting the build.
Re: Why is this so hard. (Building examples)
Quote:
Originally Posted by
wysota
You wouldn't have to do that if you explicitely ran qmake in the example directory prior to starting the build.
Tried that with no luck. Ran the qmake in the subdir of the specific sample than i want to build form Creator.