반응형
I C언어 시작하기
비주얼 스튜디오 코드 (Visual Studio Code) C / C++ 디버그 (debug) 디버깅 (debugging)
C/C++ extensions 다운로드 → 디버그 파일 → settings.json → tasks.json → launch.json
I 디버그 파일 생성
1
2
3
4
5
6
7
8
/* Generate a segfault. */
#include <stdio.h>
int main() {
int numbers[3] = {3, 4, 5};
int n = 1000000000;
printf("%d\n", numbers[n]);
}
I settings.json (compiler)
File → Preferences → Settings → User → Extensions → C/C++ → Edit in settings.json
C++
1
2
3
4
5
6
{
"C_Cpp.default.compilerPath": "C:\\MinGW\\bin\\g++.exe",
"miDebuggerPath": "C:\\MinGW\\bin\\g++.exe"
}
cs
I tasks.json (build)
Terminal → Configure Default Build Task... → Create tasks.json file from template → tasks.json
[ tasks.json ]
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe build active file",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
I launch.json (debugger)
Run → Add Configuration... → C++(GDB/LLDB) → g++.exe
[ launch.json ]
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: //go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - 활성 파일 빌드 및 디버그",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "gdb에 자동 서식 지정 사용",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
}
]
}
C언어
tasks.json; settings.json; launch.json 의 g++를 gcc로 교체
[ tasks.json ]
[ launch.json ]
[ settings.json ]
반응형
공유하기
게시글 관리
구독하기감성코딩저작자표시 비영리 변경금지