CMake cannot identify C compiler from installed Vi

2019-06-25 09:09发布

问题:

I have been trying to install CMake for vtk, but I'm getting this error message:

The C compiler identification is unknown,The CXX compiler identification is unknown.

I'm using CMake 3.2.1, vtk 6.2.0 and Visual Studio 2015.

Screenshot

回答1:

Please take a look at this answer if it helps: CMake does not find Visual C++ compiler

Basically VS2015 doesn't install Cx compilers by default. Creating a C++ project in VS2015 will force VS to download necessary compilers.



回答2:

here is what worked for me:

  1. Relaunch Visual Studio 2015 install
  2. Choose "modify"
  3. Check that both this components are installed: "Common tools for visual c++ 2015" AND "Tools and Windows XX SDK"
  4. If not, check and choose "update"

Once I installed this components, CMake was able to detect the C/C++ compiler.



回答3:

  • Open developer command prompt from visual studio tools.
  • reach to the directory where your cmake exe resides.
  • Run it.
  • Hopefully, now it will find the c and cxx compiler and run as desired.