VS code 환경 세팅
1. C++ 컴파일러 설치
2. VScode Compiler configure
3. C++ Run test
1. C++ 컴파일러 MinGW 설치
설치 링크 : https://www.mingw-w64.org/downloads/#llvm-mingw
Downloads - MinGW-w64
Downloads The heart of the Mingw-w64 project is headers and support libraries to run the output of GCC on Windows. Since Mingw-w64 is neither the home of GCC nor of binutils, several sets of installation packages which combine them are available. In additi
www.mingw-w64.org
- 사이트 이동 후 바로 'SourceForge' 클릭
- SourceForge 이동 후 아래로 스크롤해서 다음 이미지로 화면으로 이동 후 MinGW-W64 GCC - (version) 에서 첫번째 파일 다운로드
2. 컴파일러 파일 압축해제
압축 해제 프로그램 링크 : https://www.7-zip.org/
7-Zip
7-Zip 7-Zip is a file archiver with a high compression ratio. Download 7-Zip 24.06 (2024-05-26) for Windows x64 (64-bit): Link Type Windows Size Download .exe 64-bit x64 1.6 MB Download 7-Zip 24.06 for another Windows platforms (32-bit x86 or ARM64): Link
www.7-zip.org
- 프로그램 설치 후 압축해제
3. 환경 변수 설정
- 환경 변수 -> path 에서 파일 경로 추가
** mingw64\bin 으로 추가하기
4. 설치 확인
- 프롬프트에서 다음의 명령어로 확인
gcc --version
g++ --version
gdb --version
5. VS code C/C++ extensions 설치
- 이후 Configure Default Build Task 선택
- C++은 g++ , C언어는 gcc 설정
6. 컴파일러 실행
- test.cpp 생성 후 예시 코드 작성
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
return 0;
}
- Ctrl + Shift + B 눌러 빌드 하여 .exe 파일 생성
성공 시 아래의 터미널 출력이 나온다
- Ctrl + Shift + P 누른 후 C/C++: Run C/C++ file 선택
- Run 아이콘이 생기며
정상적으로 Hello World! 가 표시된것을 확인할 수 있다.
C++ 컴파일러 설치 -> VScode Compiler configure -> C++ Run test 완료!
+++ 단축키 추가 +++
VScode 좌상단 삼단바에서 ' 파일 -> 기본 설정 -> 바로 가기 키' 에서 우상단에서 아래 아이콘을 클릭 하면 keybindings.json 파일이 열림
keybindings.json에 아래 내용 입력
[
// 컴파일 단축키
{
"key": "ctrl+alt+c",
"command": "workbench.action.tasks.build"
},
// 실행 단축키
{
"key": "ctrl+alt+r",
"command": "workbench.action.tasks.test"
}
]
참고자료
1.
https://velog.io/@mimimya/Visual-Studio-Code%EC%97%90-CC-%EC%84%B8%ED%8C%85%ED%95%98%EA%B8%B0
Visual Studio Code에 C/C++ 세팅하기
서론 지난 글에서 개발환경 구축을 위해 VSCode를 설치하고 간단하게 살펴 보았다. 이번 글에서는 Visual Studio Code에서 C언어와 C++언어를 세팅하는 과정을 알아본다.
velog.io
2.
https://3dlecture.tistory.com/9
【C/C++환경설정】Visual Studio Code에서 C/C++ 코딩 환경 구축하기[Configure Visual Studio Code for C/C++]
Visual Studio Code 다운로드 및 설치 단계 1 : Google에서 "Visual Studio Code"을 검색하여, 공식사이트에서 정식판을 다운로드한다. 마이크로소프트에서 개발한 텍스트 에디터로, 2015년 4월 29일에 소개되고
3dlecture.tistory.com
'C++ > Basic' 카테고리의 다른 글
[C++] windows vscode opencv 설치 (0) | 2024.06.06 |
---|---|
Python의 한계와 C++의 필요성: 영상처리 프로그램에서의 고려사항 (0) | 2024.06.06 |