visual c++ build tools的安装与使用

16 篇文章 0 订阅

开发环境:

win10 + Microsoft Visual C++ Build Tools 2015

-----------------------------------------------------------------

 

The Microsoft Visual C++ Build Tools installs only the command-line compiler, tools, and libraries you need to build C and C++ programs. It's perfect for build labs or classroom exercises and installs relatively quickly. To install only the command-line tools, download and install Microsoft Visual C++ Build Tools 2015.

 

The following tools can help you to build a C/C++ project on the command line.

1. CL

Use the compiler (cl.exe) to compile and link source code files into apps, libraries, and DLLs.

2. Link

Use the linker (link.exe) to link compiled object files and libraries into apps and DLLs.

3. MSBuild (Visual C++)

Use MSBuild (msbuild.exe) to build Visual C++ projects and Visual Studio solutions. This is equivalent to running the Build project or Build Solution command in the Visual Studio IDE.

4. DEVENV

Use DEVENV (devenv.exe) combined with a command-line switch—for example, /Build or /Clean—to perform certain build commands without displaying the Visual Studio IDE.

5. NMAKE

Use NMAKE (nmake.exe) to automate tasks that build Visual C++ projects by using a traditional makefile.

 

在windows下开发应用或库时,如果不想安装完整的visual studio,可以选择只安装build tools在命令行下进行编译等操作。这样可以节省硬盘空间,实测占用7GB,并且装在了C盘。

 

1. 下载安装

打开链接下载安装程序: Microsoft Visual C++ Build Tools 2015,双击visualcppbuildtools_full.exe,选择默认即可,点击安装,等待10分钟左右即可完成安装。

 

2. 准备代码hello_world.c

#include<stdio.h>

int main()
{

    printf("hello vs build tools.\n");
    printf("press any key to exit.\n");
    getchar();
    return 0;

}

 

3. 编译

1)在开始菜单中选择Visual C++ 2015 x86 Native Tools Command Prompt打开命令行,然后切换到hello_world.c所在目录。

2)执行:cl hello_world.c

可看到生成两个文件,分别是hello_world.obj和hello_world.exe

 

4. 测试

执行:.\hello_world.exe

或直接双击hello_world.exe执行。

 

 

  • 79
    点赞
  • 226
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 78
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hello_courage

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值