错误:
D:\Program_Filesx86\Microsoft Visual Studio 14.0\VC\INCLUDE\cmath(17): error C2061: syntax error: identifier 'noexcept'
D:\Program_Filesx86\Microsoft Visual Studio 14.0\VC\INCLUDE\cmath(17): error C2059: syntax error: ';'
D:\Program_Filesx86\Microsoft Visual Studio 14.0\VC\INCLUDE\cmath(18): error C2449: found '{' at file scope (missing function header?)
D:\Program_Filesx86\Microsoft Visual Studio 14.0\VC\include\cstdio(36): error C2054: expected '(' to follow 'using'
D:\Program_Filesx86\Microsoft Visual Studio 14.0\VC\include\cstdio(36): error C2061: syntax error: identifier 'using'
原因:
c++代码后缀以.c结尾,且代码中包含了诸如<iostream> 之类的C++标准库的头文件,nmake编译时会把当前代码当作c来编译,所以会出错。解决办法就是将.c改成.cpp或者.cc。
错误:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
原因:
没有通过Visual Studio Developer Command Prompt启动CMD。用VS提供的Developer Command Prompt启动cmd再使用cmake命令