C++์ ์ฒ์ ์ฌ์ฉํ ๋(์ฝ๋๋ฅผ ์ง๊ฑฐ๋ ๊ฐ๋ฐํ ๋ ๋ชจ๋) ๊ฐ๋ฐํด์ ์ฌ์ฉํ๋ฉด ํธํ๊ฒ ์ฝ๋ฉํ ์ ์๋ค.
๋งฅ๋ถ์์ ์ฌ์ฉํ ์ ์๋ ๊ฐ๋ฐํด IDE(Integrated Development Environment)๋ xcode๊ฐ ์กด์ฌํ๋ค.
(xcode๋ ์ดํ ์คํ๋ฐฉ๋ฒ์ ๋ํด ๋ค๋ฃฐ ๊ฒ์ด๋ค.)
ํ์ง๋ง xcode๋ ๋ฌด๊ฑฐ์ด ํด์ด๊ธฐ ๋๋ฌธ์ ๊ทธ ๋์์ผ๋ก ์ฌ์ฉํ๋ ๊ฒ์ด VScode(Visual studio code)์ด๋ค.
VScode๋ ์์ค ์๋ํฐ์ด๊ธฐ ๋๋ฌธ์ Xcode๋ Visual Studio๋ณด๋ค๋ ๋ถํธํ ์๋ ์์ง๋ง ํ๊ฒฝ์ค์ ๋ง ์ ํด๋์ผ๋ฉด ์ ์ฉํ๊ฒ ์ฌ์ฉํ ์ ์๋ค.
Visual studio code ์ค์นํ๊ธฐ
- ์ฐ์ ์๋ ๋งํฌ๋ก ๋ค์ด๊ฐ VScode๋ฅผ ์ค์น, ์คํ์ ํ๋ค.
์ค์น ๋งํฌ: https://code.visualstudio.com
Visual Studio Code - Code Editing. Redefined
Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.
code.visualstudio.com
- ์ผ์ชฝ ๋ฉ๋ด๋ฐ์์ ํ๋ธ๋ชจ์์ ๋ฉ๋ด(Extensions)๋ฅผ ํด๋ฆญํ๋ค.
์์ง์ ๊ป๋ฐ๊ธฐ์ผ ๋ฟ์ธ VScode์ ๊ธฐ๋ฅ๋ค์ ์ถ๊ฐํ ์ ์๋ ํ๋ฌ๊ทธ์ธ๋ค์ด ๋ชจ์ฌ์๋ ๊ณณ์ด๋ค.
- c++์ ๊ฒ์ํ์ฌ install์ ํด์ค๋ค.
- code runner์ ๊ฒ์ํ์ฌ install์ ํ๋ค.
- Code Runner์ ํฑ๋๋ฐํด๋ฅผ ๋๋ฅด๊ณ Extension Settings๋ฅผ ํด๋ฆญํ๋ค.
- ์คํฌ๋กค์ ๋ด๋ ค Code-runner: Run In Terminal์ ์ฒดํฌํ๋ค.
์ด๋ ํฐ๋ฏธ๋์์ ์คํ์ํฌ ์ ์๋๋ก ์ค์ ํด์ฃผ๋ ๊ฒ์ด๋ค.
- ์คํฌ๋กค์ ์ฌ๋ ค Code-runner: Executor Map์ Edit in settings.json ์ ํด๋ฆญํ๋ค.
- .jsonํ์ผ์์ "code-runner.executorMap"์ ์ถ๊ฐํด์ค๋ค.
์ฌ๊ธฐ์ runInTerminal ๋ถ๋ถ์ " , "๋ฅผ ๊ผญ ์ฐ์ด์ค์ผ ์ค๋ฅ๊ฐ ์๋๋ค.
"code-runner.runInTerminal": true,
"code-runner.executorMap": {
"cpp": "cd $dir && g++ -std=c++11 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"
}
- Test cpp ํ์ผ์ ๋ง๋ค๋ฉด ์ฐ์ธก ์๋จ์ ์คํ๋ฒํผ์ด ์กด์ฌํ๋ค.
๋ฒํผ์ ๋๋ฅด๋ฉด ํด ํ๋จ์ ํฐ๋ฏธ๋์ด ์๊ธฐ๋ฉด์ ๊ฒฐ๊ณผ๊ฐ์ด ์ถ๋ ฅ๋๋ค.
์ฐธ๊ณ : https://wooono.tistory.com/299
[MacOS] Visual Studio Code๋ก C/C++ ์ฝ๋ฉํ๊ธฐ
MacOS์์ Windows์ Visual Studio๊ฐ์ IDE๋ ๋ํ์ ์ผ๋ก XCode๊ฐ ์๋ค. ํ์ง๋ง, ๋ญ๊ฐ ๋ถํธํ๊ณ ํนํ, PS(Problem Solving) ๊ณต๋ถํ ๋ input/output ์์ ์ฝ๊ฐ ๋ฌธ์ ๊ฐ ์๋ค. ๋ํ, PS์ฉ์ผ๋ก ๊ฐ๋ณ๊ฒ ์์ค์ฝ๋ 1๊ฐ..
wooono.tistory.com
ํธ์ง์ผ์
22.02.06
'CS > Tip' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Git & Github] ๋ก์ปฌ ๋ธ๋์น <-> ์๊ฒฉ ๋ธ๋์น ๋๊ธฐํ (1) | 2024.09.01 |
---|---|
vscode snippet ๋ง๋ค๊ธฐ (1) | 2024.07.22 |
[MacOS] gcc ์ปดํ์ผ ์ต์ ์ ๋ฆฌ (0) | 2022.02.22 |
[C/C++/MacOS] GCC ์ปดํ์ผ๋ฌ ์ค์นํ๊ธฐ (0) | 2022.02.19 |
[MacOS] ํฐ๋ฏธ๋ ์ปค๋งจ๋๋ผ์ธ ์ฌ์ฉ๋ฒ, ๋จ์ถ๊ธฐ (0) | 2022.02.12 |