11

I am getting the following error

Working on: Microsoft Windows [Versión 6.1.7601]

ErrorS:

CMake Warning at CMakeLists.txt:4 (project):
  To use the NMake generator, cmake must be run from a shell that can use the
  compiler cl from the command line.  This environment does not contain
  INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
  work.


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

    cl

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

  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:4 (project):
  The CMAKE_CXX_COMPILER:

    cl

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

  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!

If somone can help...

Mike H-R
  • 7,726
  • 5
  • 43
  • 65
user3808307
  • 2,270
  • 9
  • 45
  • 99

5 Answers5

5

Please note that I resolved the problem by adding this to my PATH environment variable where I have Visual Studio 2019 installed:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.20.27508\bin\Hostx64\x64
user8128167
  • 6,929
  • 6
  • 66
  • 79
4

You need to run the batch script provided by Visual Studio to set up your environment before running cmake. It's under X:\Visual\Studio\Dir\VC\vcvarsall.bat. There should also be a shortcut in the start menu for "Visual Studio Command Prompt" that will open a prompt and automatically run vcvarsall.bat.

Miles Budnek
  • 28,216
  • 2
  • 35
  • 52
2

As others said you can either run cmake in "Visual Studio Command Prompt" form the path @Miles said or (better way) add the path of visual studio compiler to your path. Check this path:C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin and find it in your computer, then add it in your PATH environment variable.

e3oroush
  • 3,045
  • 1
  • 17
  • 26
  • I don't think I even have Visual Studio installed :). I'll try this, thanks – user3808307 Jul 25 '15 at 22:08
  • I installed visual studio 14.0 but the file is not there. There is no vcvarsall anywhere to be found. I guess i will give up on this, I've been trying to install something for over a week. I switch to ubuntu and try over there. Thank you very much to all who answered – user3808307 Jul 26 '15 at 02:49
  • check this file if exist: `C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe` If it's existed you just have to add it in your PATH environment variable. But off course Linux is far easier for programmers :) – e3oroush Jul 26 '15 at 03:00
  • 1
    No, it doesn't The exe files I have in bin are bscmake, cvtres, mspdbrsv, nmake, undname, and xdcmake – user3808307 Jul 26 '15 at 22:49
1

I ran into the same problem. I realized that cl does not come with Visual Studio 2015, but when I installed the 2013 express, it worked.

Use the "Visual Studio 2013" -> "Visual Studio Tools" -> "VS2013 x64 Cross Tools Command Prompt".

danielbathke
  • 105
  • 5
0

Try to use "Visual Studio Command Prompt" (vcvarsall.bat)

Anton Malyshev
  • 8,686
  • 2
  • 27
  • 45