Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    C++ GUI Programming with Qt4 (2nd Edition)

    General and Desktop
    2
    10
    4890
    Loading More Posts
    • 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.
    • T
      technovelist last edited by

      Does anyone know how to get the examples in this book to work with Qt 5.3? I was led to believe that this is THE book on Qt for people who don't already know Qt, but obviously if the first, simplest example doesn't compile because Qt has changed too much from 4.3, then it isn't going to be of much use to me in learning 5.3.

      Or should I just download 4.3 and install that?

      Thank you.

      1 Reply Last reply Reply Quote 0
      • T
        technovelist last edited by

        I decided to download 4.3, but of course that requires mingw. It offers to download it for me, but of course it can't because of some problem with mirrors.

        Ok, I'll just download and install mingw myself. But wait! Which version of mingw do I have to download? The first one I tried is TOO OLD to work, so I'm trying another one.

        The error message said that the version of w32api.h is 3.17 but it requires 3.2. However, I can't find any mingw installation that uses a newer version than 3.17, so I just said "continue" and now I'll have to hope that it works.

        1 Reply Last reply Reply Quote 0
        • A
          andreyc last edited by

          "Here":https://github.com/mutse/qt5-book-code is the ported code.

          1 Reply Last reply Reply Quote 0
          • T
            technovelist last edited by

            Nope, that doesn't work either. I get as far as the "make" command, which blows up with "g++: error: unrecognized command line option '-Wl'".

            Has anyone actually been able to use this book successfully? If so, can you please tell me how?

            Thank you.

            1 Reply Last reply Reply Quote 0
            • T
              technovelist last edited by

              Thank you! But I notice that the first example is identical to the old code, and still doesn't build. Should it?

              [quote author="andreyc" date="1411438660"]"Here":https://github.com/mutse/qt5-book-code is the ported code.[/quote]

              1 Reply Last reply Reply Quote 0
              • A
                andreyc last edited by

                Works for me. I use Linux. If you use Windows try Qt MinGW
                @
                $ git clone https://github.com/mutse/qt5-book-code.git
                Cloning into 'qt5-book-code'...
                remote: Counting objects: 632, done.
                remote: Total 632 (delta 0), reused 0 (delta 0)
                Receiving objects: 100% (632/632), 479.86 KiB | 750.00 KiB/s, done.
                Resolving deltas: 100% (141/141), done.
                Checking connectivity... done.

                $ cd qt5-book-code/chap01/age
                $ qmake
                $ make
                g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/mkspecs/linux-g++ -I. -I. -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/include -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/include/QtWidgets -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/include/QtGui -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/include/QtCore -I. -o age.o age.cpp
                g++ -Wl,-O1 -Wl,-rpath,/home/thepenguin/Qt5.3.2/5.3/gcc_64 -Wl,-rpath,/home/thepenguin/Qt5.3.2/5.3/gcc_64/lib -o age age.o -L/home/thepenguin/Qt5.3.2/5.3/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread

                $ ls -l
                total 68
                -rwxrwxr-x 1 thepenguin thepenguin 14250 Sep 22 22:37 age
                -rw-rw-r-- 1 thepenguin thepenguin 818 Sep 22 22:37 age.cpp
                -rw-rw-r-- 1 thepenguin thepenguin 5456 Sep 22 22:37 age.o
                -rw-rw-r-- 1 thepenguin thepenguin 311 Sep 22 22:37 age.pro
                -rw-rw-r-- 1 thepenguin thepenguin 35029 Sep 22 22:37 Makefile

                $ ./age
                @

                1 Reply Last reply Reply Quote 0
                • A
                  andreyc last edited by

                  [quote author="technovelist" date="1411439446"]But I notice that the first example is identical to the old code, and still doesn't build. Should it?
                  [/quote]

                  One of the biggest change between Qt4 and Qt5 is that Qt5 is a set modules around some core. QtWidgets for example is a separate module. So it is possible that the examples have very few if any changes in C++ code but small change in .pro files. Like in the example above I guess it is only
                  @
                  CONFIG += widgets
                  @

                  1 Reply Last reply Reply Quote 0
                  • T
                    technovelist last edited by

                    Thanks, but exactly what should I download for Windows? There are always steps left out of the instructions, which are fine if you know what they are...

                    [quote author="andreyc" date="1411440437"]Works for me. I use Linux. If you use Windows try Qt MinGW
                    @
                    $ git clone https://github.com/mutse/qt5-book-code.git
                    Cloning into 'qt5-book-code'...
                    remote: Counting objects: 632, done.
                    remote: Total 632 (delta 0), reused 0 (delta 0)
                    Receiving objects: 100% (632/632), 479.86 KiB | 750.00 KiB/s, done.
                    Resolving deltas: 100% (141/141), done.
                    Checking connectivity... done.

                    $ cd qt5-book-code/chap01/age
                    $ qmake
                    $ make
                    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/mkspecs/linux-g++ -I. -I. -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/include -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/include/QtWidgets -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/include/QtGui -I/home/thepenguin/Qt5.3.2/5.3/gcc_64/include/QtCore -I. -o age.o age.cpp
                    g++ -Wl,-O1 -Wl,-rpath,/home/thepenguin/Qt5.3.2/5.3/gcc_64 -Wl,-rpath,/home/thepenguin/Qt5.3.2/5.3/gcc_64/lib -o age age.o -L/home/thepenguin/Qt5.3.2/5.3/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread

                    $ ls -l
                    total 68
                    -rwxrwxr-x 1 thepenguin thepenguin 14250 Sep 22 22:37 age
                    -rw-rw-r-- 1 thepenguin thepenguin 818 Sep 22 22:37 age.cpp
                    -rw-rw-r-- 1 thepenguin thepenguin 5456 Sep 22 22:37 age.o
                    -rw-rw-r-- 1 thepenguin thepenguin 311 Sep 22 22:37 age.pro
                    -rw-rw-r-- 1 thepenguin thepenguin 35029 Sep 22 22:37 Makefile

                    $ ./age
                    @[/quote]

                    1 Reply Last reply Reply Quote 0
                    • A
                      andreyc last edited by

                      If you already have Qt 5.3.2 for Windows Visual Studio edition then try to open an example project (.pro file) in QtCreator and see if it will work.

                      If you don't have Qt 5.3.2 for Windows (VS) then I would suggest
                      Qt 5.3.2 for Windows 32-bit (MinGW 4.8.2)

                      1 Reply Last reply Reply Quote 0
                      • T
                        technovelist last edited by

                        Yes, it is working now in QtCreator, after I created the .pro file via qmake. Thanks!

                        [quote author="andreyc" date="1411444066"]If you already have Qt 5.3.2 for Windows Visual Studio edition then try to open an example project (.pro file) in QtCreator and see if it will work.

                        If you don't have Qt 5.3.2 for Windows (VS) then I would suggest
                        Qt 5.3.2 for Windows 32-bit (MinGW 4.8.2)
                        [/quote]

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post