VS Code 설치방법
		- 06-30
 - 2,572 회
 - 0 건
 
Windows에서 MinGW + VS Code C/C++ 개발 환경 구축하기
1. MinGW 설치
- 
mingw-get-setup.exe실행 후 기본 옵션으로 설치 - 
설치 후 MinGW 설치 매니저 실행
mingw-developer-toolkitmingw32-basemingw32-gcc-g++선택- 필요 시 
msys-base고려 
 - 
메뉴 → Install → Apply Change →
Apply클릭 - 
환경 변수 설정
sysdm.cpl실행- 고급 → 환경 변수 → 시스템 변수 Path에 
C:\MinGW\bin추가 
 
2. VS Code 설치 및 설정
- Visual Studio Code 설치
 - 메뉴 → View → Extensions → 
"korean"검색 - Korean Language Pack for Visual Studio Code 설치 후 VS Code 재시작
 - 메뉴 → 이동 → 파일로 이동 → 
"ext install c/c++"입력 - C/C++ 확장 설치
 
3. 단축키 설정
메뉴 → 파일 → 기본 설정 → 바로 가기 키 → 아래 내용 추가
[
    // 컴파일
    { "key": "ctrl+f9", "command": "workbench.action.tasks.build" },
    // 실행
    { "key": "f9", "command": "workbench.action.tasks.test" }
]
4. tasks.json 설정
- 메뉴 → 터미널 → 기본 빌드 작업 구성
 - "템플릿에서 tasks.json 파일 만들기" 선택
 - "Other 임의의 외부 명령을 실행하는 예" 선택
 .vscode/tasks.json파일을 아래 코드로 교체
{
    "version": "2.0.0",
    "type": "shell",
    "echoCommand": true,
    "presentation": { "reveal": "always" },
    "tasks": [
        // C++ 컴파일
        {
            "label": "save and compile for C++",
            "command": "g++",
            "args": [
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "group": "build",
            "problemMatcher": {
                "fileLocation": ["relative", "${workspaceRoot}"],
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            }
        },
        // C 컴파일
        {
            "label": "save and compile for C",
            "command": "gcc",
            "args": [
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "group": "build",
            "problemMatcher": {
                "fileLocation": ["relative", "${workspaceRoot}"],
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            }
        },
        // 실행 (Windows)
        {
            "label": "execute",
            "command": "cmd",
            "group": "test",
            "args": [
                "/C", "${fileDirname}\\${fileBasenameNoExtension}"
            ]
        }
    ]
}
5. C/C++ 환경 설정
- 
메뉴 → 파일 → 기본 설정 → 설정
 - 
보기 → 명령 팔레트 →
"C/C++"검색 - 
C/C++: Edit Configurations 선택
- 여기서 includePath, IntelliSense 모드, 컴파일러 경로(
C:/MinGW/bin/g++.exe) 등을 설정 
 - 여기서 includePath, IntelliSense 모드, 컴파일러 경로(
 
	










					
로그인 후 댓글내용을 입력해주세요