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. How to run a C++ code in Qt?
Forum Update on Monday, May 27th 2025

How to run a C++ code in Qt?

Scheduled Pinned Locked Moved Installation and Deployment
123 Posts 5 Posters 108.8k 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.
  • SGaistS SGaist

    That's what I mean. Avoid white spaces it's the best thing to do on Windows.

    RelaR Offline
    RelaR Offline
    Rela
    wrote on last edited by
    #68

    @SGaist
    Just to be sure which one I need to install?Qt5.6

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

      The second one unless you are planning to use WinRT

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

      RelaR 1 Reply Last reply
      0
      • SGaistS SGaist

        The second one unless you are planning to use WinRT

        RelaR Offline
        RelaR Offline
        Rela
        wrote on last edited by Rela
        #70

        @SGaist
        I dont have any idea about that, I was just running a C++ code in Qt and get outputs in UI... how can I know if it was installed before in Qt5.5? Moreover, there is a "_64" difference between the two: qt-opensource-windows-x86-msvc2015_64-5.6.0-beta.exe 17-Dec-2015 and
        qt-opensource-windows-x86-msvc2015-5.6.0-beta.exe

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

          The _64 is to be used if you want to build a 64 bit version of your application. That also requires a 64 bit OS to run.

          The Beta doesn't installed itself in 5.5 since it's the 5.6 beta

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

          RelaR 1 Reply Last reply
          0
          • SGaistS SGaist

            The _64 is to be used if you want to build a 64 bit version of your application. That also requires a 64 bit OS to run.

            The Beta doesn't installed itself in 5.5 since it's the 5.6 beta

            RelaR Offline
            RelaR Offline
            Rela
            wrote on last edited by
            #72

            @SGaist
            My system is windows 7 64-bit, and I am going to run a C++ code using Qt with MCVS 2015.
            Just to prevent from over or re-installation again, could you please tell me which one I need to install?

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

              If you plan to only run your application on 64bit Windows, then take the 64bit version otherwise the 32.

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

              RelaR 1 Reply Last reply
              0
              • SGaistS SGaist

                If you plan to only run your application on 64bit Windows, then take the 64bit version otherwise the 32.

                RelaR Offline
                RelaR Offline
                Rela
                wrote on last edited by Rela
                #74

                @SGaist
                I installed the first one here to be able to run my projects using MCVS 2015 compiler. It worked last week. I think I have still the older Qt 5.5. and couldn't uninstall it.
                Now I am again trying to run my project, but cannot find the Qt5.6 beta. when I open the Qt shortcut on my desktop, it has only the MCVS 2013 as compiler.
                How can I run projects using Qt 5.6 beta shown here and get rid of Qt 5.5?
                In addition, when I open the "MaintenanceTool.exe" to update it, this error appears.

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

                  Qt 5 beta should be installed somewhere like C:\Qt\5.6.0. In any case you are probably using the Qt 5.5 installed Qt Creator. Either add a Qt Version and a Kit in the Preferences of Qt Creator using your Qt 5.6 beta or start the Qt Creator from Qt 5.6 beta.

                  If you don't what that mix, just remove both and re-install only Qt 5.6 beta.

                  There's nothing to update in a beta version.

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

                  RelaR 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Qt 5 beta should be installed somewhere like C:\Qt\5.6.0. In any case you are probably using the Qt 5.5 installed Qt Creator. Either add a Qt Version and a Kit in the Preferences of Qt Creator using your Qt 5.6 beta or start the Qt Creator from Qt 5.6 beta.

                    If you don't what that mix, just remove both and re-install only Qt 5.6 beta.

                    There's nothing to update in a beta version.

                    RelaR Offline
                    RelaR Offline
                    Rela
                    wrote on last edited by Rela
                    #76

                    @SGaist said:

                    Yes, Qt 5.6 beta is in C:\Qt\5.6.0. This is my Qt5.6 beta that I sent in previous post. But may I ask how to start the Qt Creator from Qt 5.6 beta?
                    Could you please let me know how to "add a Qt Version and a Kit in the Preferences of Qt Creator using Qt 5.6 beta "?

                    I was going to uninstall Qt 5.5. before installing Qt 5.6. beta, but it gave this error asked in one of my previous posts.

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

                      Like written on the dialog, don't install Qt in "Program Files", the spaces always poses problems.

                      Then use the Qt Creator from Qt 5.6 so you don't have to configure anything special, it should already have it auto-detected.

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

                      RelaR 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Like written on the dialog, don't install Qt in "Program Files", the spaces always poses problems.

                        Then use the Qt Creator from Qt 5.6 so you don't have to configure anything special, it should already have it auto-detected.

                        RelaR Offline
                        RelaR Offline
                        Rela
                        wrote on last edited by Rela
                        #78

                        @SGaist said:

                        The Qt 5.6 beta was installed in C:\Qt\5.6.0, not program file.
                        Qt 5.5 was previously installed in program files, but it worked properly. When I open Qt 5.6., this folders appear, I dont know where the Qt Creator from Qt 5.6 is.
                        When I open the Qt creator on desktop, it only shows this compiler, not "Desktop Qt 6.5. MSVC 2015".
                        I am wondering last week, I could run it immediately after I installed Qt5.6. beta.

                        1 Reply Last reply
                        0
                        • jsulmJ Online
                          jsulmJ Online
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #79

                          QtCreator should be in C:\Qt\5.6.0\Tools
                          You can create a Kit with the right compiler and Qt version in QtCreator under Tools/Options/Build & Run

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          RelaR 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            QtCreator should be in C:\Qt\5.6.0\Tools
                            You can create a Kit with the right compiler and Qt version in QtCreator under Tools/Options/Build & Run

                            RelaR Offline
                            RelaR Offline
                            Rela
                            wrote on last edited by
                            #80

                            @jsulm
                            Thanks, could you tell me the exact path of 5.6 beta creator in tools here?

                            1 Reply Last reply
                            0
                            • jsulmJ Online
                              jsulmJ Online
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #81

                              If it is there you should find it.
                              But here is the path: C:\Qt\5.6.0\Tools\QtCreator\bin\qtcreator.exe

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              RelaR 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                If it is there you should find it.
                                But here is the path: C:\Qt\5.6.0\Tools\QtCreator\bin\qtcreator.exe

                                RelaR Offline
                                RelaR Offline
                                Rela
                                wrote on last edited by Rela
                                #82

                                @jsulm

                                Thanks, It works now, but how can I replace it on desktop with previous Qt5.5 creator?

                                1 Reply Last reply
                                0
                                • jsulmJ Online
                                  jsulmJ Online
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #83

                                  You mean you want to have a short-cut on the desktop? Drag and drop qtcreator.exe to the desktop using right mouse button and then select "Create shortcuts here"

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  RelaR 1 Reply Last reply
                                  0
                                  • jsulmJ jsulm

                                    You mean you want to have a short-cut on the desktop? Drag and drop qtcreator.exe to the desktop using right mouse button and then select "Create shortcuts here"

                                    RelaR Offline
                                    RelaR Offline
                                    Rela
                                    wrote on last edited by
                                    #84

                                    @jsulm
                                    Thanks, I thought I first need to uninstall the previous version.

                                    1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      First thing: don't use cout since it will send the text to the console.

                                      You can simply put a QLabel with hello world as text as central widget of your MainWindow class.

                                      RelaR Offline
                                      RelaR Offline
                                      Rela
                                      wrote on last edited by
                                      #85
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • RelaR Offline
                                        RelaR Offline
                                        Rela
                                        wrote on last edited by
                                        #86

                                        Previously I tried a simple project to print out "Hello world" in one of my previous posts. The C++ code was written in MSVC 2013 gives output. Here is one of my previous posts related to getting output of C++ code written in MCVS 2013 in Qt5.5.
                                        Here is my previous post:
                                        "The above output was the debug using "Desktop Qt 5.5.1 MSVC2013 64 bit". I didnt debug with MinGW. The problem is the way I use to get the results in UI.
                                        I tried a simple project to print out "Hello world", the C++ code written in MSVC gives output. Could you please take a look at my files:
                                        Here are the content of C++ all files.
                                        main.cpp
                                        Bucky9.cpp
                                        stdafx.cpp
                                        targetver.h
                                        stdafx.h
                                        Now I created a Qt widget project, and I added the C++ code stdafx.h, targetver.h, and stdfx.cpp files using "Add existing Files" to the header and source. I didnt add Bucky9.cpp and main.cpp. Instead, I coppied the main.cpp C++ codes in the Qt main.cpp file with a little changes of all files.
                                        (Changes: 1- Bucky9 is not included in Qt.
                                        2- In stdafx.h #include <char.h> instead of <tchar.h>
                                        3- Including #include "stdafx.h" in mainwindow.cpp.

                                        Here are the content of all files in Qt project:
                                        main.cpp
                                        mainwindow.cpp
                                        stdafx.cpp
                                        stdafx.h
                                        targetver.h
                                        mainwindow.h"

                                        I could get "Hello worlds" with QLabel using Qt5.5 and MCVS 2013. The only difference is that I didnt change <tchar.h> in stdafx.h. Now, when I run it, it builds it, but the run button is not active. Here is the code: Qt code
                                        Is there any change when I am working with MCVS 2015 and Qt 5.6 beta? Some of my Qt 5.5. works, but some of them dont work.

                                        1 Reply Last reply
                                        0
                                        • jsulmJ Online
                                          jsulmJ Online
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #87

                                          What is the content of your *.pro file?

                                          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