Protobuf: Problem with creating a CMake configuration.

Created on 4 Sep 2016  路  10Comments  路  Source: protocolbuffers/protobuf

When installing protobuf on Windows 10 via C++, I get an error when putting the command

C:\Path\to\protobuf\cmake\build>mkdir debug & cd debug 
C:\Path\to\protobuf\cmake\build\debug>cmake -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCMAKE_INSTALL_PREFIX=../../../../install ^
 ../.. 

into the Developer Command Prompt for VS2015.

The error is:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:12 (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:12 (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:/Path/to/protobuf/cmake/build/debug/CMakeFiles/CMakeOutput.log".
See also "C:/Path/to/protobuf/cmake/build/debug/CMakeFiles/CMakeError.log".

You can find CMakeOutput and CMakeError below.

CMakeOutput.txt
CMakeError.txt

c++ cmake question

Most helpful comment

install G++

All 10 comments

I don't know if Developer Command Prompt is an issue, but can you try it in a regular command line console? Alternatively, can you try if cmake -G "Visual Studio 14" works?

Okay. I tried it again using the default cmd.exe and I still got the same error message, the same thing happens when I run cmake -G "Visual Studio 14". When I look at the error message it looks like I can't use the cl compiler. How do I fix this?

I'm sorry, but the problem persists with NMake Makefiles. I can run cmake -G "Visual Studio 14", but as it turns out, when running cmake -G "NMake Makefiles", CMake acts like it can't find the cl compiler again. Do I have to add the compilers to the environment variables?

@DrakeTM - I'm having the same issue. Can you please share your fix to this problem?

@DrakeTM - never mind. The was that I wasn't running it from the Developer Command Prompt.

Looks like CMake could not found cl compiler from your environment.
What is Developer Command Prompt for VS2015?
For VS2015 I use few Command Prompts in Start menu:

Visual Studio 2015
    > Visual Studio Tools
        > Windows Desktop Command Prompts
            > VS2015 x64 Native Tools Command Prompt
            > VS2015 x86 Native Tools Command Prompt

And It's work fine for me.

install G++

i also get this issue , so how to solve it ???

@woshisuchao, type command from apropriate command prompt.

Was this page helpful?
0 / 5 - 0 ratings