Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Solved] Compiling a simple Qt5 application
QtWS25 Last Chance

[Solved] Compiling a simple Qt5 application

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 1.5k 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.
  • F Offline
    F Offline
    FlashMustace
    wrote on last edited by
    #1

    Hello folks,

    I am new to this site, and to Qt as a whole. I have about a year of experience with both (the Ubuntu/Mint/Debian side of) Linux and Java, but none with Qt or C++ (or any truly compiled language). Some Qt5 vids on YouTube and its superiority to GTK+ on other platforms made me try it.

    I am failing to compile some very basic code. "I was trying out this tutorial by 'zetcode.com':":http://www.zetcode.com/gui/qt4/introduction/
    I downloaded and installed Qt5, added '/opt/Qt5.0.2/5.0.2/gcc_64/bin' to the PATH enviroment variable, and stuffed a file entitled 'test' with the example code:
    @
    #include <QApplication>
    #include <QWidget>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QWidget window;
    
    window.resize(250, 150);
    window.setWindowTitle("Simple example");
    window.show();
    
    return app.exec&#40;&#41;;
    

    }
    @

    In its directory, I executed the following commands:
    @qmake -project (this generates a .pro file with the name of the directory)
    qmake (this generates a 'Makefile')
    make
    make: Nothing to be done for `first'.
    @

    Well, that's basically it. According to the tutorial, 'make' supposed to do something different than saying 'nothing to be done for ` first''. It's probably a really simple switch or flag that needs to be switch, maybe even because this is not Qt4 but Qt5, but I'm out of luck. Could anyone give me a push into the right direction? I would be so happy if this worked :).

    Flash Mustace

    1 Reply Last reply
    0
    • F Offline
      F Offline
      FlashMustace
      wrote on last edited by
      #2

      I solved it. Apperantly, not giving a source file the ".cpp" extension causes either 'make' or 'qmake' to behave weird.
      Anyway, it's fixed now.

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

        Hi and welcome to devnet,

        Could you post the pro file generated ?

        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
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Indeed, file extensions are very important when programming.

          .h for header and .cpp are the most common for c++ (you could use hpp also but it's not as widely used IFAIK)

          qmake uses the file extension to setup the right compiler for your files.

          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

          • Login

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