Table of contents
No headings in the article.
Download and install a C++ compiler:
Install mingw for mac by running the below command after installing the macPorts from above (ports.macports.org/port/mingw-w64)
sudo port install mingw-w64
This will take around 10mins depending upon your net speed
- Add the mingw installation path in your PATH variable
Check your current PATH first
echo $PATH
- Append the mingw installation path in your existing PATH variable
export PATH=“\bin:$PATH”
Install Code Runner extension in VS Code
After installing restart VsCode. Open your C++ file in VsCode.
If you do not do this step then all logs would be seen in output window. If you want to see it in terminal then follow below steps
In VsCode, Go to Code > Preference > Setting.
In the User tab on the left panel, find the extensions section
Scroll and find ‘Run Code Configuration’
Scroll and find a checkbox "Run in Terminal"
Close the terminal & relaunch. You can click the play button on top right of the editor for running the code
Tadaa!! Your cpp file is running successfully on vs code