기나긴 삽질 끝에...


근데 폴더별로 vscode설정 넣어줘야 함

그러고 아직 폴더에 있는 cpp 파일일경우 제대로 안되는데 이거는 좀더 해봐야 할듯


ms에서 만든 cpp extension을 깔고


task.json 만들기

(Command + shift + P)에서 기본 빌드 작업 구성(Tasks:Configure Default Build Task) 누르면 자동으로 생김

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version""2.0.0",
    "tasks": [
        {
            "label""build cpp",
            "type""shell",
            "command""g++",
            "args": [
                "-g",
                "빌드할 cpp 파일"
            ],
            "group": {
                "kind""build",
                "isDefault"true
            }
        }
    ]
}
cs


그다음 디버그창에 들어가서 설정을 누르면 launch.json파일이 생김

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
    // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
    // 기존 특성에 대한 설명을 보려면 가리킵니다.
    // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
    "version""0.2.0",
    "configurations": [
        {
            "name""(lldb) Launch",
            "type""cppdbg",
            "request""launch",
            "program""${workspaceFolder}/a.out",
            "args": [],
            "stopAtEntry"false,
            "cwd""${workspaceFolder}",
            "environment": [],
            "externalConsole"true,
            "MIMode""lldb",
 
            "osx": {
                "command""clang++",
                "args": [
                    "-Wall",
                    "main.cpp",
                    "-v"
                  ],
                "isShellCommand"true,
                "showOutput""always",
                "problemMatcher": {
                    "owner""cpp",
                    "fileLocation": [
                        "relative",
                        "${workspaceRoot}"
                    ],
                    "pattern": {
                        "regexp""^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                        "file"1,
                        "line"2,
                        "column"3,
                        "severity"4,
                        "message"5
                    }
                }
            }
        }
    ]
}
cs



하고 실행하면 터미널이 뜨면서 출력은 터미널에 되는데 중간에 디버그 찍으면 vscode로 걸림

'C++' 카테고리의 다른 글

c++ 이름 감추기  (0) 2018.03.27
Fold expression, constexpr  (0) 2018.02.05
auto decltype  (0) 2018.01.08
c++11 typedef 사용하기  (0) 2018.01.08
enum to string  (0) 2017.08.03

+ Recent posts