Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. New to Qt and having trouble with qmake
QtWS25 Last Chance

New to Qt and having trouble with qmake

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 3 Posters 2.2k 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.
  • C Offline
    C Offline
    crickles
    wrote on last edited by
    #1

    I am learning C++ and new to Qt and having trouble setting it up. I'm using C++ GUI Programming with Qt 4 since i cant seem to find anything on Qt 5. The book has me make a hello world type program to start and when it comes time to compile, I'm getting stuck. I'm using Qt 5.3 for Desktop (MinGW 4.8) command prompt to compile and I think I have the path set right.

    I have them set as ;C:\Qt\5.3\mingw482_32\bin;C:\Qt\Tools\mingw482_32\bin; under environment variables

    When I compile I follow the book and cd to folder "...\Hello" which contains Hello.cpp

    "qmake -project" creates Hello.pro and when I try to enter "qmake Hello.pro" I get

    Cannot read C:/Qt/Tools/mingw482_32/bin/g++.exe/qmake.conf: The system cannot find the path specified.
    Could not read qmake configuration file C:/Qt/Tools/mingw482_32/bin/g++.exe/qmake.conf
    Error processing project file: Hello.pro

    EDIT

    So I figured it out. I made the Environment Variable QMAKESPEC like the qmake manual directed me to but I had the value set wrong.

    The correct value ended up being "C:\Qt\5.3\mingw482_32\mkspecs\win32-g++"

    but now, when I get to the next step in the books compilation process, I enter "mingw32-make" and I get an error that says
    Hello.cpp:1:24: fatal error: QApplicatoin: No such file or directory
    #include <QApplication>

    compilation terminated.

    The book says that if I get this error, then I have an older version of Qt and I should get a Qt 4.1.1 or later release. The problem is that I downloaded and installed Qt a week or so ago so I should have the latest build.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You are following a Qt 4 tutorial with Qt 5. There have been some changes in between. You need to add QT += widgets to use QApplication.

      Anyway, since you are on windows and starting, you should rather use Qt Creator to create the projects, it will save you time and headaches.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Hi,

        I agree with SGaist. If you use Qt Creator, you won't need to worry about environment variables at all.

        Just create a project using File -> New File or Project... -> Applications -> Qt Widgets Application.

        You will also find a more up-to-date tutorial at http://qt-project.org/doc/qt-5/gettingstartedqt.html

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        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