compile c++ codes using Visual C++ Build Tools from the command prompt

copyright (C) 2011-2017 iesensor.com

Introducing the Visual Studio Build Tools

“If you have installed Microsoft Visual C++ Build Tools 2015 on Windows 10, open the Start menu and choose All apps. Scroll down and open the Visual C++ Build Tools folder. Choose Visual C++ 2015 x86 Native Tools Command Prompt to open the command prompt window.”

1) for single file source file

cl -> gcc , but the command options is different,

cl /EHsc hello.cpp

https://msdn.microsoft.com/en-us/library/f35ctcxw.aspx

2) for a small project, CMake is recommended,

it is handy to write one from example CMakeLists.txt online.

In your source code folder: md build && cd build && cmake ..

then using nmake instead of make

3) for exsitent vs solution using msbuild:

compile visual studio solution/project designed by VS IDE, no corresponding command on Linux.

search “MSBuild Command-Line Reference”

In the near future, other light weight IDE might support detecting “Visual Studio Build Tools”, e.g QtCreator

BSD documentation licensed Free for non-commercial usage only
Author: Qingfeng XIA copyright (C) 2011-2013 http://www.iesensor.com
please keep the original link in your reference. http://www.iesensor.com/blog/2016/12/06/compile-c-codes-using-visual-c-build-tools-from-the-command-prompt/
This entry was posted in Programming. Bookmark the permalink.