Search code examples
visual-c++cmakekdevelop

Setting up Kdevelop


I'm trying to setup Kdevelop and am getting a compiler error.

C:/Users/alexm/projects/SFMLGL/build> "C:/Program Files/CMake/bin/cmake.exe" "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" "-DCMAKE_BUILD_TYPE=Debug" C:/Users/alexm/projects/SFMLGL
-- The C compiler identification is unknown
CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCompilerId.cmake:141 (file):
  file problem creating directory:
  C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/3.6.1/CompilerIdCXX
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCompilerId.cmake:40 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCXXCompiler.cmake:113 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:2 (project)


-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

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


CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  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 "C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/CMakeError.log".
*** Failure: Exit code 1 ***

I've been googling a lot and read that I should download "Make", so I have and it did reduce the amount of errors I have, but I still have this and I don't understand a word of it.

I think it wants me to download a C compiler? How would I go about doing this?


Solution

  • The default toolchain for CMake tries to use the Visual Studio C++ Compiler.

    If you want to use Visual Studio (you need to have that installed) you can run your CMake command from the »VS201X x64 Native Tools Command Prompt« shortcut in the start menu.

    An alternative would be to use GCC for Windows via mingw-w64 which is available in msys2. There you would have to install the compiler via pacman -S mingw-w64-x86_64-toolchain and optionally cmake too via pacman -S mingw-w64-x86_64-cmake.
    You could then run your command from the mingw64 prompt of msys2.

    If you want to use that in KDevelop you’d have to add your msys64/mingw64/ folder to the path, or start it from the Visual Studio command prompt mentioned above. I’m not sure if there is an easier way.

    Your question raises the question^^ what you want to achieve in the end. You don’t seem to know about which compiler to use (this may be important if you have binary dependencies) or what make is (which is a bit alarming).