C++

General

Visual Studio

Download Visual Studio @ Visual Studio Downloads page. Open it and install Desktop development with C++ (Tools > Get Tools and Features…).

  1. File > New > Project > Console App > Create
  2. Generate *.exe to Debug folder from *.cpp file: Build > Build Solution
  3. Run generated *.exe either at cmd or F5 (Debug > Start Debugging)
    • Can also directly run *.cpp without generating its *.exe with F5
  1. Create DLL: File > New > Project > DLL > Create
  2. Project > Add New Item > Header File > Add

Visual Studio Code

Installation

  1. Click Extensions icon (Ctrl + Shift + X)
  2. Search and Install C/C++ and C/C++ Extension Pack extensions

VS & VS Code

  1. Install the Microsoft Visual C++ (MSVC) compiler toolset
    • Search for and install Build Tools for Visual Studio 20xx @ Older Downloads in Visual Studio Downloads page

Confirm compiler with cl.exe (which is the C/C++ compiler driver) by executing cl in the Developer Command Prompt for VS (located here by default: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 20xx\Visual Studio Tools)

Install Mingw-w64 (follow install instructions @ MSYS2)

Set to System variables PATH (C:\msys64\mingw64\bin)

Create tasks.json: Terminal > Configure Default Build Task > cl.exe

command gets VSC to run cl.exe

args arguments (order crucial) to pass to cl.exe

${file} is the active file

/Fe: switch to create exe

exe is created in present directory ${fileDirname}

${fileBasenameNoExtension}.exe is the created exe file using the cpp’s filename (e.g. abc.cpp builds to abc.exe)

label is seen in the tasks list (name is customizable)

problemMatcher selects the output parser to use for finding errors and warnings in the compiler output. For cl.exe, you’ll get the best results if you use the $msCompile problem matcher.

group is object

“isDefault”: true runs task with Ctrl+Shift+B (if set to false, run task @ Terminal > Run Build Task…)

Build task by running task (explained above) (prerequisite: VS Code to start from Developer Command Prompt for VS with code .)

Run task by typing .\<filename>.exe

Prerequisite

Download Turbo C: https://developerinsider.co/downloading/?download=https://github.com/vineetchoudhary/turbocpp/releases/download/v3.2/Turbo.C.3.2.zip?raw=true&after=https://developerinsider.co/c-and-cpp-insider/

Create a drive named Turbo C++ in your PC’s C drive.

Now extract the contents of the zip file into the root of the Turbo C++ folder.

Once the files have been successfully extracted click on the file named install.exe

Follow the on-screen instructions and install Turbo C++

Use

Open and Run cpp file in Turbo C++

Info

When return 0 is placed in main, the program will exit

Pages ( 1 of 12 ): 1 23 ... 12Next »

--- :: Skyferia Tech's Related Posts :: ---