Important: Please read the Qt Code of Conduct -

Problem Building Qt C++ Examples

  • Hi All,

    I've downloaded and installed the latest release of Qt for windows, however I can't seem to builld any of the included examples.

    When I try to build for example the config dialog example I get a lot of compiler errrors which I can't explain.

    Any help appreciated,


    Running build steps for project configdialog...
    Starting: "c:/qt/2010.05/qt/bin/qmake.exe" C:/Qt/2010.05/qt/examples/dialogs/configdialog/ -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/dialogs/configdialog-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/dialogs/configdialog-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"......includeQtCore" -I"......includeQtGui" -I"......include" -I"......includeActiveQt" -I"tmpmocdebug_shared" -I"..configdialog" -I"." -I"......mkspecswin32-g++" -o tmpobjdebug_sharedconfigdialog.o ..configdialogconfigdialog.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"......includeQtCore" -I"......includeQtGui" -I"......include" -I"......includeActiveQt" -I"tmpmocdebug_shared" -I"..configdialog" -I"." -I"......mkspecswin32-g++" -o tmpobjdebug_sharedmain.o ..configdialogmain.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"......includeQtCore" -I"......includeQtGui" -I"......include" -I"......includeActiveQt" -I"tmpmocdebug_shared" -I"..configdialog" -I"." -I"......mkspecswin32-g++" -o tmpobjdebug_sharedpages.o ..configdialogpages.cpp

    C:Qt2010.05qtbinmoc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"......includeQtCore" -I"......includeQtGui" -I"......include" -I"......includeActiveQt" -I"tmpmocdebug_shared" -I"..configdialog" -I"." -I"......mkspecswin32-g++" -D__GNUC__ -DWIN32 ..configdialogconfigdialog.h -o tmpmocdebug_sharedmoc_configdialog.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"......includeQtCore" -I"......includeQtGui" -I"......include" -I"......includeActiveQt" -I"tmpmocdebug_shared" -I"..configdialog" -I"." -I"......mkspecswin32-g++" -o tmpobjdebug_sharedmoc_configdialog.o tmpmocdebug_sharedmoc_configdialog.cpp

    c:Qt2010.05qtbinrcc.exe -name configdialog ..configdialogconfigdialog.qrc -o tmprccdebug_sharedqrc_configdialog.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"......includeQtCore" -I"......includeQtGui" -I"......include" -I"......includeActiveQt" -I"tmpmocdebug_shared" -I"..configdialog" -I"." -I"......mkspecswin32-g++" -o tmpobjdebug_sharedqrc_configdialog.o tmprccdebug_sharedqrc_configdialog.cpp

    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debugconfigdialog.exe tmp/obj/debug_shared/configdialog.o tmp/obj/debug_shared/main.o tmp/obj/debug_shared/pages.o tmp/obj/debug_shared/moc_configdialog.o tmp/obj/debug_shared/qrc_configdialog.o -L"c:Qt2010.05qtlib" -L"c:Program FilesSQLXML 4.0bin" -L"c:Qt2010.05qtlib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4

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

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

    tmp/obj/debug_shared/configdialog.o: In function `ConfigDialog':

    C:Qt2010.05qtexamplesdialogsconfigdialog-build-desktop/../configdialog/configdialog.cpp:46: undefined reference to `_imp___ZN7QDialogC2EP7QWidget6QFlagsIN2Qt10WindowTypeEE'

    C:Qt2010.05qtexamplesdialogsconfigdialog-build-desktop/../configdialog/configdialog.cpp:48: undefined reference to `_imp___ZN11QListWidgetC1EP7QWidget'

    C:Qt2010.05qtexamplesdialogsconfigdialog-build-desktop/../configdialog/configdialog.cpp:49: undefined reference to `_imp___ZN9QListView11setViewModeENS_8ViewModeE'

    C:Qt2010.05qtexamplesdialogsconfigdialog-build-desktop/../configdialog/configdialog.cpp:50: undefined reference to `_imp___ZN17QAbstractItemView11setIconSizeERK5QSize'

    C:Qt2010.05qtexamplesdialogsconfigdialog-build-desktop/../configdialog/configdialog.cpp:51: undefined reference to `_imp___ZN9QListView11setMovementENS_8MovementE'

    C:Qt2010.05qtexamplesdialogsconfigdialog-build-desktop/../configdialog/configdialog.cpp:52: undefined reference to `_imp___ZN7QWidget15setMaximumWidthEi'

    C:Qt2010.05qtexamplesdialogsconfigdialog-build-desktop/../configdialog/configdialog.cpp:53: undefined reference to `_imp___ZN9QListView10setSpacingEi'

    C:Qt2010.05qtexamplesdialogsconfigdialog-build-desktop/../configdialog/configdialog.cpp:55: undefined reference to `_imp___ZN14QStackedWidgetC1EP7QWidget'

    etc etc...

  • Try to set env PATH to directory with qtdll's.

  • [quote author="Alexander Kuchumov" date="1291307762"]Try to set env PATH to directory with qtdll's.[/quote]

    It seems that compiler cannot find libs, not dlls. Maybe, something wrong with *.a file location (or how iit is called in mingw), spaces in the path or LIB value in *.pro file?

  • blex, yes, path to libs

  • Thanks all for your replies. Unfortunatly, it didn't help me any further.

    I wanted to evaluate Qt, and given the fact that after a default installation on XP I can't build the included examples is a bit frustrating and definatly not what I expected. So currently thumbs down on Qt, but I don't give up yet!

    In the environment settings, I've added C:\Qt\2010.05\qt\bin to the PATH. Further I noticed that in Projects -> Run settings one can make also change the build, clean and environment settings, but I am not sure what to look for here what could be wrong...

    Any further help appreciated.

  • Please look at option

    -L”c:Program FilesSQLXML 4.0bin”

    in your output. I think it is a forum bug that no back-slash are present. It contains space in the directory name. Try to remove this path - I do not know where your environment got it.

  • I have just compile you example using QtCreator but from build 2010.01

    Instead of make try the IDE:

    • open project in QtCreator,
    • select the proper version of Qt (Tools - Options - Qt4 - Qt Versions - Default Qt version): in your case it should be c:\qt\2010.05\qt\bin\qmake.exe
    • Build - Run qmake
    • Build - Run

  • Hi Blex,

    Thanks! It was indeed related to the environment setting for lib ”c:\Program Files\SQLXML 4.0\bin”.

    Once I removed it from the environment settings I was able to build an run the examples.

    Thumps up again!

  • So, the resolution: Never use spaces in path to library files.

  • Just noticed the topic header. If you can correct it - its Qt and not QT(Quick Time)

  • I'm having the exact same problem and I cannot figure it out for the life of me. I went as far as to put the lib directory into the system path and I am still unable to compile the example applications.

    Below is the compile output. I was able to get it to compile once. Then I took the lib dir out of the path to make sure that was the solution and I haven't been able to get it to compile since. I have no idea whats wrong and I'm pretty disappointed that the default installation does not work. Any help would be appreciated.

    _Running build steps for project animatedtiles...
    Configuration unchanged, skipping qmake step.
    Starting: "C:/Qt4/2010.05/mingw/bin/mingw32-make.exe" -w
    mingw32-make: Entering directory `C:/Qt4/2010.05/qt/examples/animation/animatedtiles'

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

    mingw32-make[1]: Entering directory `C:/Qt4/2010.05/qt/examples/animation/animatedtiles'

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

    mingw32-make[1]: Leaving directory `C:/Qt4/2010.05/qt/examples/animation/animatedtiles'

    mingw32-make: Leaving directory `C:/Qt4/2010.05/qt/examples/animation/animatedtiles'

    tmp/obj/debug_shared/main.o: In function `Z5qMainiPPc':

    C:\Qt4\2010.05\qt\examples\animation\animatedtiles/main.cpp:136: undefined reference to `imp___ZN12QApplicationC1ERiPPci'_

  • The problem appears to be caused by the lib C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\

    Please check your system properties -> Environment settings on your Windows machine. Likely there is a variable with name LIB listed and which has the value C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib. Delete this entry and try again to run qmake and to rebuild the application.

    This was what caused my problem as well.

  • Thanks, that got me a bit futher but then i ran into another known problem ->

    I was eventually able to get past this but why hasn't this been bug resolved? Should I reopen this bug? This is experience does not leave a good impression especially as a first time user.

Log in to reply