BACKEND/C
Windows C++ 개발환경 (Visual Studio Code)
circle.j
2024. 9. 11. 13:55
1. Visual Studio Code 설치
https://code.visualstudio.com/Download
Download Visual Studio Code - Mac, Linux, Windows
Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.
code.visualstudio.com
2. C/C++ 확장 플러그 설치


3. Mingw 컴파일러 설치
MSYS2
Software Distribution and Building Platform for Windows
www.msys2.org


Mingw-w64 tool 설치 명령어 입력
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain




4. 환경 변수 설정

mingw64의 bin 폴더 경로를 복사한다.
C:\msys64\mingw64\bin




Mingw의 설치 확인을 위해 cmd에서 명령어를 입력한다.
gcc --version

Hello World
cpp 확장자 파일을 생성한다.

// 표준 입출력 스트림라이브러리 (콘솔에 출력)
#include <iostream>
using namespace std; // std 네임스페이스를 전역으로 사용하겠다는 선언
// 프로그램의 진입점인 메인 함수 정의 (반환값이 int형)
int main() {
cout << "Hello World"; // 콘솔에 문자 출력
return 0; // 프로그램 종료 (0: 정상 종료)
}
"Run and Debug"에서 launch.json 파일을 생성한다.

C++ (GDB/LLDB)를 클릭한다.

json 파일을 생성 후 다시 해당 cpp 파일에서 C++ (GDB/LLDB)를 클릭한다.

g++ 컴파일러를 클릭한다.

터미널에서 컴파일 결과를 확인한다.
