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. My first console C++ program on Qt Creator
Forum Updated to NodeBB v4.3 + New Features

My first console C++ program on Qt Creator

Scheduled Pinned Locked Moved Solved General and Desktop
35 Posts 6 Posters 11.8k Views 5 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
    #14

    What do you get if you call make after that ?

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

    tomyT 1 Reply Last reply
    0
    • SGaistS SGaist

      What do you get if you call make after that ?

      tomyT Offline
      tomyT Offline
      tomy
      wrote on last edited by
      #15

      @SGaist
      Do you mean I type "make" on the last line?

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

        Yes, that's it.

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

        tomyT 2 Replies Last reply
        1
        • SGaistS SGaist

          Yes, that's it.

          tomyT Offline
          tomyT Offline
          tomy
          wrote on last edited by
          #17
          This post is deleted!
          1 Reply Last reply
          0
          • SGaistS SGaist

            Yes, that's it.

            tomyT Offline
            tomyT Offline
            tomy
            wrote on last edited by tomy
            #18

            @SGaist
            Thanks. I did it and it showed the output I wanted on the Terminal.
            But still I see the errors and red lines on the code! :(

            Why while the program runs successfully does Qt Qreator show them? And how to get rid of them. They are ugly indeed.

            0_1548111980062_1.png

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

              Try changing the code model used by Qt Creator.

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

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

                @tomy said in My first console C++ program on Qt Creator:

                Of course. I get 6 issues. 5 of them are errors and one warning, as shown in the screenshot in the first post here.

                The screenshot in your first post shows errors and warnings from the static code analyzer, not from your compiler. We can tell because the red circle and yellow triangles are "hollow". Errors and warnings from your compiler have "filled" circles and triangles.

                Try to build and run your code to activate your compiler. Does it run successfully?

                Anyway, you are seeing these errors because the static code analyzer thinks you are writing C code (not C++ code) for some reason. You can disable it by clicking Help > About Plugins... and unchecking C++ > Clang Code Model

                @tomy said in My first console C++ program on Qt Creator:

                If using qmake in Linux (Ubuntu) is this way, I did and below is the output. My project is on the Desktop named "hello_world".

                0_1548109120848_1.png

                I believe @SGaist meant running qmake from within Qt Creator, when your project is open. The menu item is Build > Run qmake.

                Running qmake in the console does not change anything in Qt Creator.

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

                1 Reply Last reply
                4
                • SGaistS SGaist

                  Try changing the code model used by Qt Creator.

                  tomyT Offline
                  tomyT Offline
                  tomy
                  wrote on last edited by
                  #21

                  @SGaist

                  What are the preferences choices for console C++ programming on the code model section, please?
                  How to find a way to be rid of these bothersome issues and go on programming?

                  JKSHJ 1 Reply Last reply
                  0
                  • tomyT tomy

                    @SGaist

                    What are the preferences choices for console C++ programming on the code model section, please?
                    How to find a way to be rid of these bothersome issues and go on programming?

                    JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #22

                    @tomy said in My first console C++ program on Qt Creator:

                    What are the preferences choices for console C++ programming on the code model section, please?

                    As I said in my previous post, you can disable the Clang Code Model clicking Help > About Plugins... and unchecking C++ > Clang Code Model

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

                    tomyT 1 Reply Last reply
                    1
                    • JKSHJ JKSH

                      @tomy said in My first console C++ program on Qt Creator:

                      What are the preferences choices for console C++ programming on the code model section, please?

                      As I said in my previous post, you can disable the Clang Code Model clicking Help > About Plugins... and unchecking C++ > Clang Code Model

                      tomyT Offline
                      tomyT Offline
                      tomy
                      wrote on last edited by
                      #23

                      @JKSH
                      Thanks so much. It removed the majority of the red underlines.
                      Only two lines remain!

                      0_1548113155555_1.png

                      One more thing: Why does the IDE think I'm C coding while I explicitly told it by choosing "plain C++" that I would be coding on C++?

                      JKSHJ 1 Reply Last reply
                      0
                      • tomyT tomy

                        @JKSH
                        Thanks so much. It removed the majority of the red underlines.
                        Only two lines remain!

                        0_1548113155555_1.png

                        One more thing: Why does the IDE think I'm C coding while I explicitly told it by choosing "plain C++" that I would be coding on C++?

                        JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #24

                        @tomy said in My first console C++ program on Qt Creator:

                        Why does the IDE think I'm C coding while I explicitly told it by choosing "plain C++" that I would be coding on C++?

                        I don't know. It works fine for me on Windows.

                        It might be related to your Kit settings (this is just a guess).

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

                        tomyT 1 Reply Last reply
                        0
                        • JKSHJ JKSH

                          @tomy said in My first console C++ program on Qt Creator:

                          Why does the IDE think I'm C coding while I explicitly told it by choosing "plain C++" that I would be coding on C++?

                          I don't know. It works fine for me on Windows.

                          It might be related to your Kit settings (this is just a guess).

                          tomyT Offline
                          tomyT Offline
                          tomy
                          wrote on last edited by
                          #25

                          @JKSH
                          Kids are only the Desktop kit:

                          0_1548151415171_1.png

                          By the way, I'm on Linux. Have you tried a plain C++ project on Linux to see if there are those red underlines or not?

                          Cobra91151C JKSHJ 2 Replies Last reply
                          0
                          • tomyT tomy

                            @JKSH
                            Kids are only the Desktop kit:

                            0_1548151415171_1.png

                            By the way, I'm on Linux. Have you tried a plain C++ project on Linux to see if there are those red underlines or not?

                            Cobra91151C Offline
                            Cobra91151C Offline
                            Cobra91151
                            wrote on last edited by
                            #26

                            @tomy

                            Hi! I think the problem is with your compiler, try setting it as g++ not gcc.

                            For example, using MinGW on Windows (compiler path is ....\g++.exe):

                            0_1548163802423_2019-01-22_152922.png

                            tomyT 1 Reply Last reply
                            1
                            • tomyT tomy

                              @JKSH
                              Kids are only the Desktop kit:

                              0_1548151415171_1.png

                              By the way, I'm on Linux. Have you tried a plain C++ project on Linux to see if there are those red underlines or not?

                              JKSHJ Offline
                              JKSHJ Offline
                              JKSH
                              Moderators
                              wrote on last edited by
                              #27

                              @tomy said in My first console C++ program on Qt Creator:

                              By the way, I'm on Linux. Have you tried a plain C++ project on Linux to see if there are those red underlines or not?

                              Unfortunately, I don't have a Linux machine with a recent version of Qt and Qt Creator.

                              One thing you could try is to create a Qt Console Application, then remove Qt from the .pro file.

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

                              1 Reply Last reply
                              0
                              • Cobra91151C Cobra91151

                                @tomy

                                Hi! I think the problem is with your compiler, try setting it as g++ not gcc.

                                For example, using MinGW on Windows (compiler path is ....\g++.exe):

                                0_1548163802423_2019-01-22_152922.png

                                tomyT Offline
                                tomyT Offline
                                tomy
                                wrote on last edited by
                                #28

                                @Cobra91151
                                Is it on Linux, please?
                                The options are different between Windows and Linux.

                                Cobra91151C 1 Reply Last reply
                                0
                                • tomyT tomy

                                  @Cobra91151
                                  Is it on Linux, please?
                                  The options are different between Windows and Linux.

                                  Cobra91151C Offline
                                  Cobra91151C Offline
                                  Cobra91151
                                  wrote on last edited by Cobra91151
                                  #29

                                  @tomy

                                  I don't think that Qt Creator is different on Linux and Windows. Check: Tools -> Options -> Kits -> Compilers. Then select your compiler and click Browse. Your compiler should be "..\g++.exe" or something similar to it. Check if it's available for you.

                                  1 Reply Last reply
                                  0
                                  • tomyT Offline
                                    tomyT Offline
                                    tomy
                                    wrote on last edited by
                                    #30

                                    There is no g++ unfortunately.

                                    0_1548195294218_1.png

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

                                      Do you mean you only have gcc installed ?
                                      In that case, install g++.

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

                                      tomyT 1 Reply Last reply
                                      0
                                      • SGaistS SGaist

                                        Do you mean you only have gcc installed ?
                                        In that case, install g++.

                                        tomyT Offline
                                        tomyT Offline
                                        tomy
                                        wrote on last edited by
                                        #32

                                        @SGaist
                                        I've that installed in its newest version on the machine.

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

                                          Can you show what the kit you are using looks like ?

                                          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

                                          • Login

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