Development record of developer who study hard everyday.

, ,

How to ready for configure c++ programming setting of VS Code in Mac

 How to ready for configure c++ programming setting of VS Code in Mac.


1. Install VS Code

https://code.visualstudio.com/download


2. Install C++ extension.

Go to extension setting

Go to extension setting.

Code - Preferences - Extension


Install c++ extension

Find C/C++ extension and install it.


3. Install Code Runner extension.

Install Code Runner extension.

Find Code Runner extension.


Go to extension setting

Go to Extension Settings


Enable "Run In Terminal"

Enable "Run In Terminal"


Edit in settings.json

   Click "Edit in settings.json"


Explanation for settings.json

This file shows build options when Code Runner build source code.

(In my case, I will build .cpp file)


"cpp": "cd $dir && g++ -std=c++17 *.cpp -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

👆 I build all cpp file in this folder using c++ version 17.


"cpp": "cd $dir && g++ -std=c++17 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",

👆 If you want to build only current file, you might use "$fileName" instead of "*.cpp".


4. Run

Run the source code

Run the code.

The shortcut is "control + option + N"  or you can click run icon right above.



Share:

댓글 없음:

댓글 쓰기