오래전에 VScode를 시도하다가 디버그가 아무리 해도 안되길래 포기했던것인데...
사실 지금도 이게 되는건지는 모르겠다
야매로 되는 것 같아서 일단은 쓰기로 함
1. Extensions
이렇게 2가지를 설치했다
2. Build & Run
test.cpp를 클릭하고 shift + command + b
c는 build_gcc / c++ 는 build_g++ 로 빌드
빌드 후 shift + command + b 한후 exec를 하면 run 된다
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build_gcc",
"type": "shell",
"command": "gcc",
"args": [
"-g",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.out",
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "build_g++",
"type": "shell",
"command": "g++",
"args": [
"-g",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.out",
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "exec",
"type": "shell",
"command": "${fileDirname}/${fileBasenameNoExtension}.out",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
}
]
}
참고블로그
youngq.tistory.com/5?category=764306
[MAC] VSCode로 C/C++ 사용하기 (3/3)
MAC에서 VSCode를 사용하여 C언어와 C++을 사용하는 방법 전편에 이어서 작성된 글입니다. 본편에서는 디버거 연동을 다룹니다. 전편에 이어서 이번에는 디버깅을 하는 과정을 다루겠습니다. [왼쪽�
youngq.tistory.com
이 분 블로그를 참고했는데 안타깝게도 맨마지막 줄에 쓰신
디버그를 발견하지 못했다는 것이 바로 나였다...
2. Debug
디버그 모양 아이콘을 클릭한다
fn + F5를 누르면 디버그 실행
음 원래 디버그 콘솔에 뭐가 많이 나와야 정상인가본데... 난왜 안되는지는 모르겠지만
보통 중단점으로 변수확인을 많이해서.. 일단 변수변화는 왼쪽 variables에 보여지고 ,
창왼쪽 상단에 | >이모양? 을 누르면 변화를 볼 수 있으므로 일단 넘어가기로 했다
launch.jason
{
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
// 기존 특성에 대한 설명을 보려면 가리킵니다.
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.out",
"args": [],
"preLaunchTask": "C/C++: g++ build active file",
"stdio": [null,null,null],
"terminal": "integrated"
}
]
}
블로그와 다른점은
preLaunchTask 이부분을 자신에게 있는 task로 바꾸어주어야 한다는것...
나는 C/C++: g++ build active file이길래 이걸로했는데
생각해보면 빌드를 build_g++/gcc로 하는데 그걸로 해야하는거아닌가 하는생각이 근데 일단 되니까 넘어가기로함ㅋ
(사실 빌드는 C/C++ 빌드 액티브 파일 이걸눌러도 빌드를 해주긴 한다.. 별 문제 없을 듯)
참고블로그
justdoitproject.tistory.com/31
[VSCode] Macbook에서 C/C++ 개발환경 구축하기
Mac OS에서 C/C++ 개발하기 윈도우 운영체제를 쓰는 분들이라면 C/C++ 개발시 Visual Studio를 많이 사용하실텐데요. 저도 Windows를 주로 쓰다가 최근에 맥북프로를 사용하게 되면서 C/C++ 개발환경을 새롭
justdoitproject.tistory.com
'MAC(Intel, M1) WINDOW' 카테고리의 다른 글
[git] GitHub + GitKraken 작업환경 (0) | 2021.08.26 |
---|---|
[Docker]Docker란? M1 Docker 설치 (0) | 2021.07.02 |
Google drive 와 github연동하기 (0) | 2021.06.09 |
[git] Git + Terminal 연동 (0) | 2021.03.28 |
[MAC] VSCode git과 연동하기 (0) | 2020.07.08 |