Vscode launch.json 설정 c++ - vscode launch.json seoljeong c++

반응형

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= {345};

    int n = 1000000000;

    printf("%d\n", numbers[n]);

}

 

 

 

I settings.json (compiler)

 

File → Preferences → Settings → User → Extensions → C/C++ → Edit in settings.json

 

File > Preferences > Settings

 

Settings > User > Extensions > C/C++ > System Include Path > 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

 

Terminal > Configure Default Build Task...

 

[ 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

            }

        }

    ]

}

 

 

Terminal > Run Build Task...

 

Run Build Task...

 

 

 

I launch.json (debugger)

 

Run  Add Configuration...  C++(GDB/LLDB)  g++.exe

 

Run > Add Configuration...

 

C++ (GDB/LLDB)

 

g++.exe

 

debugging

 

[ launch.json ]

 

[ 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 ]

 

 

반응형

공유하기

게시글 관리

구독하기감성코딩

저작자표시 비영리 변경금지

'C 언어 > C언어 시작하기' 카테고리의 다른 글

비주얼 스튜디오 코드 (Visual Studio Code) - .vscode 파일  (0)2020.09.21비주얼 스튜디오 코드 (Visual Studio Code) C / C++ 실행시 변수(문자열) 입력  (0)2020.06.19비주얼 스튜디오 코드 (Visual Studio Code) C / C++ 터미널 입력  (0)2020.06.16비주얼 스튜디오 코드 (Visual Studio Code) C / C++ 컴파일  (4)2019.06.19비주얼 스튜디오 코드 (Visual Studio Code) 설치  (0)2019.06.11

How do I run a launch json in VS Code?

VS Code keeps debugging configuration information in a launch.json file located in a .vscode folder in your workspace (project root folder) or in your user settings or workspace settings. To create a launch.json file, click the create a launch.json file link in the Run start view.

Where is C_cpp_properties json in VS Code?

Press Ctrl+Shift+P, start typing “C/C++” and then choose Edit Configurations (JSON) from the list of suggestions. VS Code creates a file called c_cpp_properties. json and populates it with default settings.

How to run C code in VS Code?

After writing the code, right-click on the program, as shown below. Click on the Run Code option or press Ctrl + Alt + N from the button.

What is VS Code launch json?

A launch. json file is used to configure the debugger in Visual Studio Code. Visual Studio Code generates a launch. json (under a . vscode folder in your project) with almost all of the required information.

Toplist

최신 우편물

태그