当前位置:网站首页>配置用命令行编译的环境-MSVC
配置用命令行编译的环境-MSVC
2022-06-11 02:43:00 【shlyyy】
配置用命令行编译的环境--MSVC
虽然vs2019是非常好用的IDE,但有时候命令行编译会更简单好用,下面就是用配置使用MSVC编译程序的环境。
一、安装vs2019
vs安装的话网上一大堆啦,不会的话自己百度就行啦
二、配置环境变量
安装完vs2019以后会发现在vs2019的同盘符下会有一个Windows Kit文件夹。
打开环境:
点击第一个系统
找到最下面的关于,在相关设置栏目下有一个高级系统设置

新建 WIN10_INCLUDE 环境变量
E:\Windows Kits\10\Include\10.0.19041.0
新建 WIN10_LIB 环境变量
E:\Windows Kits\10\Lib\10.0.19041.0
新建 MSVC 环境变量:
E:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133
新建 INCLUDE 环境变量,添加以下4项内容:
%WIN10_INCLUDE%\ucrt
%WIN10_INCLUDE%\shared
%WIN10_INCLUDE%\um
%MSVC%\include
新建 LIB 环境变量,添加以下两项内容:
%MSVC%\lib\x86
%WIN10_LIB%\ucrt\x86;%WIN10_LIB%\um\x86
我这里选择的是编译32位的程序,所以是x86文件夹,如果是64位程序可以改成x64,下面的也一样。
在 Path 环境变量里添加以下路径
%MSVC%\bin\Hostx86\x86
三、测试环境
新建test.c文件
#include <stdio.h>
int main()
{
printf("Hello world!\r\n");
return 0;
}
打开命令行,切换路径到test.c所在的文件夹下:
执行以下编译指令后会生成一个test.obj文件
cl /c /W3 test.c
执行以下链接指令会生成一个test.exe可执行文件
link test.obj
最后直接输入test即可执行test.exe
为了方便直接,执行以下run.bat脚本,即可编译,链接,执行:
del *.obj
del *.exe
cl /c test.c /W3
link test.obj
test.exe
pause
四、参考
边栏推荐
猜你喜欢
![[189. rotation array]](/img/cc/0da616ad9adc9c9d352e54f58dbe41.png)
[189. rotation array]

B_QuRT_User_Guide(17)
![[long time series prediction] aotoformer code detailed [3] model overall architecture analysis](/img/77/30215c363ae8a1324db1cbcaa5324b.png)
[long time series prediction] aotoformer code detailed [3] model overall architecture analysis
![[Fibonacci series]](/img/03/70b1363e91142a8600d97c59b01b0f.png)
[Fibonacci series]

同一个用户的两次请求SessionId竟然不一致-----记录问题

Live broadcast! Feature matching of orb-slam3 series (mlpnp, word bag model, etc.).

靠贴牌飞利浦冲击上市,德尔玛的自有品牌又该如何“起跳”?

2022年熔化焊接与热切割操作证考试题库及答案

CPT 102_ LEC 16

怎样确保消息的可靠性投递?
随机推荐
第七章 常用的协议简介(1)
B / Qurt Utilisateur Guide (19)
Google Gmail mailbox marks all unread messages as read at once
Go quick start of go language (I): the first go program
Rs232/rs485 to 4G DTU uploading temperature and humidity sensor data based on Modbus protocol to remote TCP server
Application of the remote acquisition IOT gateway of the Bashir trough flowmeter in open channel flow monitoring
OpenJudge NOI 1.13 18:Tomorrow never knows?
How to handle error code 30204-44 when installing office 2016 in win10?
Arduino Uno接JQ8900-16p语音播报模块
Location data fusion Table 3
jdbc工具类的问题
HUST Software Engineering (Experiment 2) -- TDD test driven development experiment.
Solr initialization failure: requesthandler INIT failure
Array full permutation
Arduino使用NRF24L01模块进行无线通信
Looking at the ups and downs of the mobile phone accessories market from the green Union's sprint for IPO
Go 语言的优势和学习路线图
怎样简洁明了地说清楚产品需求?
CPT 102_ LEC 15
Three ways of reflection