๋ฆฌ๋ ์ค์ ๋ช ๋ น์ด๋ค
ls - ํ์ฌ ํด๋๋ด ํ์ผ๊ณผ ํด๋๋ฅผ ํ์ํด์ค
pwd - ํ์ฌ ๊ฒฝ๋ก๋ฅผ ํ์ํด์ค
clear - ์ง์ฐ๊ฐ
cd ํด๋๋ช - ํด๋๋ช ํด๋๋ก ๊ฒฝ๋ก ์ด๋
cd ~/ - ์ต์์ ํด๋๋ก ์ด๋
code ํด๋๋ช - ํด๋๋ช ์ ์์ ํด๋๋ก ํ๋ vs code ์คํ
./ํ์ผ๋ช - ํ์ผ๋ช ์ ์ฝ๋๋ฅผ ์คํ์์ผ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฌ์ค
code . - ํ์ฌ ๊ฒฝ๋ก์ ํด๋๋ฅผ ์์ ํด๋๋ก ํ๋ vs code ์คํ
mkdir ํด๋๋ช - ํด๋๋ช ์ ํด๋ ์์ฑ
๋น์ฃผ์ผ ์คํ๋์ค ์ฝ๋ ์ด๊ธฐ ์ค์
๋น์ฃผ์ผ ์คํ๋์ค ์ฝ๋ ์คํ - Terminal - Configure Default Build Task... - C/C++ gcc build active file์ ํด๋ฆญํ๋ฉด
tasks.json์ด๋ผ๋ ํ์ผ์ด ์์ฑ๋๋ค.
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: /usr/bin/gcc"
},
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/gcc"
}
]
}
์ฌ๊ธฐ์ "args": [ .......] ์์ชฝ์ ๋ ๊ฐ์ง๋ฅผ ์ถ๊ฐํด์ฃผ์ด์ผ ํ๋ค.
"-ansi"
"-Wall"
์ด๊ฒ ์ ๋๋ก ์ถ๊ฐ๊ฐ ๋์๋ค๋ฉด, ๋น๋๋ฅผ ํ์ ๋ ์๋์ ๊ฐ์ ์ค๋ฅ ๋ฉ์ธ์ง๊ฐ ๋ฌ๋ค.
* Executing task: C/C++: gcc build active file
Starting build...
/usr/bin/gcc -ansi -Wall -fdiagnostics-color=always -g /root/prac/asd/main.c -o /root/prac/asd/main
/root/prac/asd/main.c: In function โmainโ:
/root/prac/asd/main.c:7:5: error: C++ style comments are not allowed in ISO C90
// ์ฃผ์
^
/root/prac/asd/main.c:7:5: error: (this will be reported only once per input file)
Build finished with error(s).
* The terminal process failed to launch (exit code: -1).
* Terminal will be reused by tasks, press any key to close it.
๊ถ๊ธํ ๊ฒ
1. ์ฐ๋ถํฌ ํฐ๋ฏธ๋์์ ์ต์์ ํด๋๋ก ์ด๋์ ํ ํ pwd๋ฅผ ํด๋ณด๋ฉด, ๋ด ๋ ธํธ๋ถ๋ง ์ต์์ ํด๋๊ฐ /root/... ์ด๋ค. ๋ค๋ฅธ ์ฌ๋๋ค์ ๋ชจ๋ /home/ubuntu/... ์๋ค. ์ ๋ค๋ฅธ๊ฑฐ๊ณ ์ด๋ค ๋ฌธ์ ๊ฐ ์๋๊ฑธ๊น?
- ๊ต์๋๊ป ์ฌ์ญค๋ณด๋ ์๊ด์๋ค๊ณ ํ์ฌ.
2. tasks.josnํ์ผ์ ๋ฌด์์ด๋ฉฐ, ์ด ํ์ผ์ ๋ง๋ค๊ธฐ ์ํด์ ๋๋ฅด๋ Terminal - Configure Default Build Task... ๋ ๋ฌด์์ธ๊ฐ?
'๐ Coding Study' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
2023.03.21 ํ (IF๋ฌธ, CPU ๋ช ๋ น์ด ์ฌ์ดํด) (0) | 2023.03.22 |
---|---|
2023.03.20 ์ (PHP ์ฐ์ฐ์, HTML ๋ถ๋งํฌใ๋ฆฌ์คํธใํ ์ด๋ธ ) (0) | 2023.03.20 |