LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   qt-creator Cannot run compiler 'g++' (https://www.linuxquestions.org/questions/programming-9/qt-creator-cannot-run-compiler-g-4175654947/)

sharky 05-31-2019 11:31 PM

qt-creator Cannot run compiler 'g++'
 
General messages in qt-creator after setting up first project.

Quote:

/usr/lib64/qt5/mkspecs/features/toolchain.prf(70): system(execute) requires one or two arguments.
Project ERROR: Cannot run compiler 'g++'. Maybe you forgot to setup the environment?
Error while parsing file /home/$USER/scripts/$PROJ/$PROJ/$PROJ.pro. Giving up.
Verified g++ from a terminal by compiling a simple hello world. If there is a place in qt-creator to point to the compiler I can't find it.

centos 7.6
qt-creator 4.1.0

This worked out of the box in a mint linux install but I need to run this in centos for work.

Any idea what might be wrong? I've done pyqt stuff before but I'm a total newbie to c++/qt. Assume I know nothing.

Thanks in advance.
Cheers,

Michael Uplawski 06-01-2019 12:25 AM

In the qt-creator sidebar, click on Projects. On the left of the new window, you click on the button “Manage Kits”. Select the Kit/Qt-version of your choice and verify the settings.

Normally all this is configured automatically and I cannot know why it did not for your project.

astrogeek 06-01-2019 12:27 AM

I have never used QT_Creator, but a quick search tunred up this page in the docs, Adding Compilers as the first hit. It indicates that most times this is configured automatically, but you can set multiple compilers manually.

sharky 06-02-2019 12:01 PM

Quote:

Originally Posted by Michael Uplawski (Post 6000925)
In the qt-creator sidebar, click on Projects. On the left of the new window, you click on the button “Manage Kits”. Select the Kit/Qt-version of your choice and verify the settings.

Normally all this is configured automatically and I cannot know why it did not for your project.

There is no 'Auto-detected' kit. There is a 'Manual' kit listed but I do not recall setting it up.

These are the properties of the 'Manual' kit.

Quote:

Name: Desktop
File system name: <blank>
Device type: Desktop
Device: Local PC (default for Desktop)
Sysroot: <blank>
Compiler: GCC (x86 64bit in /usr/bin)
Environment: No changes to apply.
Debugger: System GDB at /usr/bin/gdb
Qt version: Qt 5.9.2 in PATH (System)
Qt mkspec: <blank>
CMake Tool: System CMake at /usr/bin/cmake
CMake Generator: CodeBlocks - Unix Makefiles
CMake Configuration CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable}; QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}
I don't understand most of that.

Michael Uplawski 06-02-2019 01:15 PM

Quote:

Originally Posted by sharky (Post 6001317)
There is a 'Manual' kit listed but I do not recall setting it up.

In your configuration the C++ compiler is missing. The executable in this case is not called gcc, but g++. Usually a second line is at display for “Compiler”. If you know that g++ is available, try the button “Manage”, then “Add”.

Okay. As the situation is unknown to me, I can only suggest a Trial&Error approach. Once the compiler is definitely installed and added to the kit, or a different one, open your project in Qt-Creator. There should be an icon on the outer left edge of the window, the fourth from the bottom, naming your currently opened project. Clicking that, the available kits are listed, in your case at least one should appear. Try to select it, even if there is only one kit available; release or debug should not make much difference.

sharky 06-03-2019 08:53 PM

Apparently the compiler was running the whole time despite the error message.

Opened a terminal looked in the build directory and there was a compiled executable than ran like a charm.

So the qt-creator has an issue but it's not the issue I thought.

Not sure if I should mark this a solved or not.

astrogeek 06-03-2019 09:33 PM

Quote:

Originally Posted by sharky (Post 6001837)
Not sure if I should mark this a solved or not.

There are no hard and fast rules for that, but whenever your own interest in it has been satisfied it would be appreciated and would signal others that you are at an end point with it.

Thanks, and good luck!


All times are GMT -5. The time now is 09:09 PM.