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. CMake + vscode
Forum Updated to NodeBB v4.3 + New Features

CMake + vscode

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 3 Posters 3.5k Views 2 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    Might be a silly question but do you show any widget in your application ?

    If so, can you share your main.cpp file ?

    Does the application start successfully ?

    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
    • H Offline
      H Offline
      Hyderman
      wrote on last edited by
      #3

      My main.cpp

      #include <QApplication>
      #include <QPushButton>
      
      int main(int argc, char *argv[]) {
          QApplication a(argc, argv);
          QPushButton button("Hello world!", nullptr);
          button.resize(200, 100);
          button.show();
          return QApplication::exec();
      }
      

      Both CMakeLists build the project but the second one do nothing when i run the build.

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

        That looks perfectly fine.

        How do you start your application ?

        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
        • H Offline
          H Offline
          Hyderman
          wrote on last edited by
          #5

          I use the .exe in my build folder.

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

            And you have no error ? Just the application that is hanging ?

            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
            • M Offline
              M Offline
              mchinand
              wrote on last edited by mchinand
              #7

              Your 'working' CMake project is copying the Qt dlls and plugin folders to where your .exe is created. You could copy those post-build steps to your other CMakeLists.txt file; the entire if (WIN32) block at the end of the CMakeLists.txt.

              1 Reply Last reply
              1
              • H Offline
                H Offline
                Hyderman
                wrote on last edited by
                #8

                It's not hanging it just runs without error.
                Why i have to copy all that and can't use the CMake of the tutorial ?

                M 1 Reply Last reply
                0
                • H Hyderman

                  It's not hanging it just runs without error.
                  Why i have to copy all that and can't use the CMake of the tutorial ?

                  M Offline
                  M Offline
                  mchinand
                  wrote on last edited by
                  #9

                  Alternatively, you can add the Qt bin folder to your PATH.

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

                    If you take Qt Creator, it will adapt the PATH environment variable so that it will contain the path for the Qt version you are using to build your application. If your current IDE does not provide that automation, then your application will need to have all its dependencies copied beside it. That is nothing Qt specific though, any dependency you have must be findable by your executable,

                    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
                    1
                    • H Offline
                      H Offline
                      Hyderman
                      wrote on last edited by
                      #11

                      Thanks guys it works perfectly now.

                      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