cmake常见错误

错误:

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命令

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值