Visual C ++

Visual C ++

May 31, 2016

For another way to run C++ code, in addition to the one described in last night's tip, try installing Visual C++ Build Tools which are available here, at the link named Microsoft Visual C++ Build Tools 2015.     The instructions on this page will show you how to run C ++ code .cpp files in  Windows command prompt.   In this example we're going to run a C ++ code called sortstring.cpp which can be found in this online library.   After the software is installed, you just need to follow these steps:


1. In the Programs menu go tothe  Visual C++ Build Tools folder, the Windows Desktop Command Prompt Tools subfolder and select Visual C++ 2015 x86 Native Build Tools Command Prompt.


2. Go ahead and create a folder at the root of your C drive named 'hello' and save a .cpp file there.


3.  Go back to the command prompt and type in 


cd c:\hello


to change the directory to the folder containing your cpp file.


4. Now type in 

cl /HEsc sortstring.cpp


5. This should generate an executable file in the source folder.     Now at the command prompt type the name of the C++code file, without the extension, and press enter.


6.   The program created by the code should run.   In this example, the user is prompted to enter a total number of strings, followed by each string, and the code automatically sorts them in order. 





Please reload

Contact Me With Your Litigation Support Questions:

  • Twitter Long Shadow

© 2015 by Sean O'Shea . Proudly created with