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.
Code - Preferences - Extension
Find C/C++ extension and install it.
3. Install Code Runner extension.
Find Code Runner extension.
Go to Extension Settings
Enable "Run In Terminal"
Click "Edit in 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 code.
The shortcut is "control + option + N" or you can click run icon right above.
댓글 없음:
댓글 쓰기