Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem Building Qt C++ Examples
Forum Update on Monday, May 27th 2025

Problem Building Qt C++ Examples

Scheduled Pinned Locked Moved General and Desktop
13 Posts 5 Posters 14.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JoDi
    wrote on 2 Dec 2010, 16:28 last edited by
    #1

    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,

    John

    Running build steps for project configdialog...
    Starting: "c:/qt/2010.05/qt/bin/qmake.exe" C:/Qt/2010.05/qt/examples/dialogs/configdialog/configdialog.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/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...

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexander
      wrote on 2 Dec 2010, 16:36 last edited by
      #2

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

      1 Reply Last reply
      0
      • B Offline
        B Offline
        blex
        wrote on 2 Dec 2010, 19:52 last edited by
        #3

        [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?


        Oleksiy Balabay

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alexander
          wrote on 2 Dec 2010, 20:25 last edited by
          #4

          blex, yes, path to libs

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JoDi
            wrote on 3 Dec 2010, 07:32 last edited by
            #5

            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.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              blex
              wrote on 3 Dec 2010, 07:45 last edited by
              #6

              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.


              Oleksiy Balabay

              1 Reply Last reply
              0
              • B Offline
                B Offline
                blex
                wrote on 3 Dec 2010, 07:49 last edited by
                #7

                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

                Oleksiy Balabay

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JoDi
                  wrote on 3 Dec 2010, 08:31 last edited by
                  #8

                  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!

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    blex
                    wrote on 3 Dec 2010, 08:37 last edited by
                    #9

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


                    Oleksiy Balabay

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kamalakshantv
                      wrote on 3 Dec 2010, 12:25 last edited by
                      #10

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

                      1 Reply Last reply
                      0
                      • O Offline
                        O Offline
                        osiris2600
                        wrote on 15 Dec 2010, 03:55 last edited by
                        #11

                        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'_

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          JoDi
                          wrote on 15 Dec 2010, 06:42 last edited by
                          #12

                          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.

                          1 Reply Last reply
                          0
                          • O Offline
                            O Offline
                            osiris2600
                            wrote on 15 Dec 2010, 13:07 last edited by
                            #13

                            Thanks, that got me a bit futher but then i ran into another known problem -> http://bugreports.qt.nokia.com/browse/QTCREATORBUG-1889

                            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.

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved