My first console C++ program on Qt Creator
-
@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".
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.
-
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?@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
-
@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
-
@JKSH
Thanks so much. It removed the majority of the red underlines.
Only two lines remain!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++?
@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).
-
@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).
-
@JKSH
Kids are only the Desktop kit: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?
wrote on 22 Jan 2019, 13:32 last edited byHi! I think the problem is with your compiler, try setting it as
g++
notgcc
.For example, using
MinGW
onWindows
(compiler path is ....\g++.exe): -
@JKSH
Kids are only the Desktop kit: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?
@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.
-
Hi! I think the problem is with your compiler, try setting it as
g++
notgcc
.For example, using
MinGW
onWindows
(compiler path is ....\g++.exe):wrote on 22 Jan 2019, 20:39 last edited by@Cobra91151
Is it on Linux, please?
The options are different between Windows and Linux. -
@Cobra91151
Is it on Linux, please?
The options are different between Windows and Linux.wrote on 22 Jan 2019, 20:46 last edited by Cobra91151I don't think that
Qt Creator
is different onLinux
andWindows
. 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. -
wrote on 22 Jan 2019, 22:14 last edited by
-
Do you mean you only have gcc installed ?
In that case, install g++. -
Can you show what the kit you are using looks like ?
-
wrote on 23 Jan 2019, 10:44 last edited by
@tomy said in My first console C++ program on Qt Creator:
There is no g++ unfortunately.
If you have it installed, click the Add button to navigate and add the
g++
compiler toQt Creator
.Note:
Make sure you know the path tog++
compiler on your system. -
wrote on 23 Jan 2019, 12:43 last edited by
Thanks so much to you both.
The problem was with the kits. I defined gcc for the C++ compiler and it removed the redundant stuff from the code.
29/35