Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Qt Creator can't find CMAKE_CXX_COMPILER compiler in linux mint 64 bit

Writer Matthew Martinez

I'm trying to use cmake to build a simple hello world c++ application in Qt Creator 4.7.0-beta1 and I get the following error:

Running "/usr/bin/cmake /home/cpnblank/Documents/vulkandev/cmaketest '-GCodeBlocks - Unix Makefiles' -DCMAKE_CXX_COMPILER:STRING= -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc -DCMAKE_PREFIX_PATH:STRING=/home/cpnblank/Qt/5.11.0/gcc_64 -DQT_QMAKE_EXECUTABLE:STRING=/home/cpnblank/Qt/5.11.0/gcc_64/bin/qmake" in /tmp/QtCreator-CRirhE/qtc-cmake-DuSxtHku.
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:3 (project): No CMAKE_CXX_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred! See also "/tmp/QtCreator-CRirhE/qtc-cmake-DuSxtHku/CMakeFiles/CMakeOutput.log". See also "/tmp/QtCreator-CRirhE/qtc-cmake-DuSxtHku/CMakeFiles/CMakeError.log". *** cmake process exited with exit code 1.

I have build-essentials installed, and I have also set the cxx path to g++. I have also uninstalled and reinstalled g++ and gcc.

Any ideas?

3

2 Answers

It happens as your qtproject kits can't find the suitable compiler for cmake.

For CMAKE convenience first install Ninja-Build. Also you will need GCC or Clang and GDB.

apt install ninja-build gcc gdb clang

And for qt environment setup convenience you can use:

apt install qt5-default or apt install qt4-default

Now ninja will try to configure your cmake properly.
You may also need to go to:

Tool -> Options -> Kits -> ...

...then select the kit you need to use and in compiler section select gcc or clang c++ for c++ compiler and gcc or clang c for c compiler.

This error appears when the compiler is not correctly set, and thus, cmake is not able to find it.

This is obvious, but when you are using QtCreator, you have to take into account where this information is defined. It is defined in the "kit" specification.

First of all, check if your "Kit" is properly configured. Go to the menus and select:

Tools->Options.

Then, in the Options window, select "Build & Run" in the left column. Then, select the "Kits" tab in the right panel. There you can see a list of the available Kits.

Select the kit you want to use. If you have more than one option and you don't know which one choose to use the default option (i.e. "Desktop Qt 5.2.1 GCC 64bit (default)").

In the kit configuration list, check the row named "Compiler". If the C++ compiler is configured as "No compiler, there is the problem. Select one of the compilers in the list (you can select the base GCC (C++) for example). Then press the "OK" button, and try to generate the project from scratch (remove the generated files and open it again).

If the compiler is configured, make sure that is the correct one, and check if the path to the binary is correct.

NOTE: If the list has not the desired compiler, you can add it in the "Compilers" tab. There, press "Add" button and select the desired options.

NOTE2: If the compiler list is empty...maybe you need to install QtCreator again.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.