๋น์ฃผ์ผ ์คํ๋์ค.. ๋ฌด๊ฒ๋ค..
๊ณต๋ถ์ฉ์ผ๋ก ๊ฐ๋จํ๊ฒ ์ฝ๋๋ง ๋๋ ค๋ณด๋ ค๊ณ VSCode์์ ์ฌ์ฉํ ์ ์๊ฒ๋ ์ค์น ๋ฐฉ๋ฒ์ ์ฐพ์๋ณด์๋ค
์๋์ ๊ธ๋๋ก ์ญ ์งํ
https://dntmdgns03.tistory.com/113
VSCode C์ธ์ด ์คํํ๊ธฐ
1. C/C++ ์ปดํ์ผ๋ฌ(๋ฒ์ญ๊ธฐ) ์ค์นVisual Studio Code(VSCode)๋ ์ฝ๋ ํธ์ง๊ธฐ์ด๊ธฐ ๋๋ฌธ์ ๊ฐ ์ธ์ด์ ๋ฒ์ญ๊ธฐ๋ ์ฌ์ฉ์๊ฐ ์ง์ ์ค์นํด์ผ ํฉ๋๋ค.์๋ ๋งํฌ์์ MinGW-w64 GCC๋ฅผ ์ค์นํฉ๋๋ค. MinGW-w64 ๋ค์ด๋ก๋ ๋งํฌx
dntmdgns03.tistory.com
MinGW-w64 GCC ์ค์น. ์ง๊ธ์ ํ ๋ฒ์ ์ฌ๋ผ์ x86_64-15.2.0-release-posix-seh-msvcrt-rt_v13-rev0 ์ด๋ค
์ค๋ช ๋๋ก ์์ถ ํ๊ณ ~ ํ๊ฒฝ ๋ณ์ ๋ฑ๋กํด์ฃผ๊ณ ~
์๋์ฐ cmd์์ gcc -v ์คํํ๋ฉด
(base) C:\Users\userpc>gcc -v ์ก์ธ์ค๊ฐ ๊ฑฐ๋ถ๋์์ต๋๋ค.
(base) C:\Users\userpc>g++ --version ์ก์ธ์ค๊ฐ ๊ฑฐ๋ถ๋์์ต๋๋ค.
ํ๊ฒฝ ๋ณ์๋ mingw64 ํด๋ ์์น ์ด์์๋๋ฐ..?

์.. ์ ๊ฑฐ ์์ ํด๋์์ ํ๊ณ ์ mingw64๋ฅผ C:๋ก ๊บผ๋ด์ค๋ฉด ์ธ์์ ๋ชปํ๋ค
์ ์ฐฝ ๋จ๋ฉด ๊ทธ๋ฅ ์ ๋๋ฅด๊ณ ์งํํ๋ ์ด ๋ถ๋ถ์ ํด๊ฒฐ
๊ธ ๋ฐ๋ผ์ ์ญ ์งํํ๋ค
VSCode์์ Hello World ์ถ๋ ฅํ๋ ๊ฐ๋จํ cํ์ผ ๋ง๋ค์ด์ฃผ๊ณ C/C++ ํ์ฅํฉ๋ค๋ ์ค์นํด์ฃผ๊ณ ์ปดํ์ผ๋ฌ ์ค์ ๋ ํด์ฃผ๊ณ ~
์ปดํ์ผ๊ณผ ์คํ์ ํธํ๊ฒ ํ๊ฒ๋ ๋จ์ถํค๋ ์ค์ ํด์ค๋ค
์ปดํ์ผ์ ctrl+alt+c , ์คํ์ ctrl+alt+r
tasks.json ํ์ผ์ .vscode ํด๋์ ์์ฑํ๊ณ ์๋ ค์ค๋๋ก ๋ณต์ฌํด์ ๋ฃ์๋ค
๊ทธ๋ผ c ํ์ผ์ ์ปดํ์ผํด์ ์คํ์์ผฐ์ ๋ Hello World๊ฐ ๋์์ผํ๋๋ฐ..!
* Executing task: ""gcc -std=c23"
"C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study\study.c"
-o "C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study/study""
'"gcc -std=c23"'์(๋) ๋ด๋ถ ๋๋ ์ธ๋ถ ๋ช
๋ น, ์คํํ ์ ์๋ ํ๋ก๊ทธ๋จ, ๋๋ ๋ฐฐ์น ํ์ผ์ด ์๋๋๋ค.
* The terminal process "C:\WINDOWS\System32\cmd.exe /d /c
""gcc -std=c23" "C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study\study.c"
-o "C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study/study""" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

tasks.json์์ "gcc -std=c23" ์๊ฒ ๋ฌธ์
gcc๋ก ์คํํ๋๊ฑด๋ฐ ๋ค์ -std=c23๊น์ง ํต์ฑ๋ก ๋ช ๋ น์ด๋ก ์ธ์ํด๋ฒ๋ ค์ gcc๋ฅผ ๋ชป์ฐพ์...
C, C++ ๋ชจ๋ ์๋์ ๊ฐ์ ํํ๋ก args์ ๋ถ๋ฆฌํด์ ์ถ๊ฐํด์ฃผ์๋ค
{
"version": "2.0.0",
"tasks": [
{
"label": "build C program",
"type": "shell",
"command": "gcc",
"args": [
"-std=c23",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"]
}
]
}
* Executing task: gcc -std=c23 "C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study\study.c" -o
"C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study/study"
'gcc'์(๋) ๋ด๋ถ ๋๋ ์ธ๋ถ ๋ช
๋ น, ์คํํ ์ ์๋ ํ๋ก๊ทธ๋จ, ๋๋ ๋ฐฐ์น ํ์ผ์ด ์๋๋๋ค.
* The terminal process "C:\WINDOWS\System32\cmd.exe /d /c
gcc -std=c23 "C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study\study.c"
-o "C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study/study"" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

VS Code์์ gcc๋ฅผ ๋ชป์ฐพ๋๋ด๋ค.. VS Code๊ฐ MinGW์ PATH๋ฅผ ์ธ์ํ์ง ๋ชปํจ
ํฐ๋ฏธ๋์์๋ gcc ๋ฒ์ ์ฒดํฌ ๋ช ๋ น ๋ฑ์ ์คํํ๋ฉด ์ ๋์ํ๋ค
๊ทธ๋ฌ๋ ์ ์ปค๋งจ๋์ gcc๋ง ๋ฌ๋ ์๋ ๊ฑธ ์๋์ฒ๋ผ ์ ๋๊ฒฝ๋ก๋ก ์ก์์ฃผ์๋ค
"command": "C:\\mingw64\\bin\\gcc.exe"
์ข์ ๊ทธ๋ผ ์ปดํ์ผ์ ๋ค์ ๋๋ ค๋ณด๋ฉด
* Executing task: C:\mingw64\bin\gcc.exe -std=c23
"C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study\.vscode\tasks.json"
-o "C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study\.vscode/tasks"
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file
C:\Users\userpc\Downloads\ \c_study\.vscode/tasks.exe: No space left on device
collect2.exe: error: ld returned 1 exit status
* The terminal process "C:\WINDOWS\System32\cmd.exe /d /c
C:\mingw64\bin\gcc.exe -std=c23
"C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study\.vscode\tasks.json"
-o "C:\Users\userpc\Downloads\๋ถ์คํธ์บ ํ ์๋ฃ\c_study\.vscode/tasks""
terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

ld.exe: cannot open output file ... No space left on device
์ฉ๋์ด ์๋ค...? 20GB ๋๊ฒ ๋จ์์๋๋ฐ..?
์ ์ปดํ์ผ ํ๋ ค๋ ํ์ผ ๊ฒฝ๋ก ์ค ๋์ด์ฐ๊ธฐ๋ ํ๊ธ์ด ์์ผ๋ฉด ์ด๋ฐ ๊ฒฝ์ฐ๊ฐ ๋ฐ์ํ ์๋ ์๋ค๊ณ ํ๋ค
๋ค์ด๋ก๋ ํด๋๋ก ์ฎ๊ฒจ์ฃผ์๋๋
* Executing task: C:\mingw64\bin\gcc.exe -std=c23 C:\Users\userpc\Downloads\c_study\study.c -o C:\Users\userpc\Downloads\c_study/study
* Terminal will be reused by tasks, press any key to close it.
* Executing task: cmd /C C:\Users\userpc\Downloads\c_study\study
Hello World
์ ๋์ํ๋ ๊ฒ์ ํ์ธํ ์ ์๋ค
๋.