打开cmd,键入cl虽然返回了安装版本反馈,不代表就配置正确能用了.
很可能安装过程中安装版本太乱碰到系统平台不匹配等问题
比如
- 装的cl是什么系统的?x86还是x64??
- 中间去环境变量注册LIB和INCLUDE时注意添加路径与cmd首行显示的windows版本相同.
然后编辑一个简答的cpp文件,去编译链接执行看是否正常显示结果.
//hello.cpp
#include <iostream>
using namespace std;
int main(){
cout<<"hello, CSDN"<<endl;
return 0;
}
编译执行命令
cl hello.cpp /EHsc & hello.exe
此处可以更改编译器的版本为64位或32位,前提是把对应的include及lib写入环境变量
最后两个是交叉编译设置
- x86_amd64:指在32位系统编译,目标是运行在64位系统
- amd64_x86:指在64位系统编译,目标是运行在32位系统