VSCode c++ 설정

규규·2024년 2월 2일
0

C++

목록 보기
4/21

기본 설정

c_cpp_properties.json : 컴파일러 경로 및 IntelliSense 설정
tasks.json : 빌드 지침
launch.json : 디버거 설정

tasks.json 수정해서 여러 C++ 파일 빌드 가능
"workspaceFolder/.cpp"insteadof"{workspaceFolder}/*.cpp" instead of "{file}".This will build all .cpp files in your current folder. You can also modify the output filename by replacing "fileDirname/{fileDirname}/{fileBasenameNoExtension}" with a hard-coded filename (for example 'helloworld.out').

CMake 설정

  • CMake 로 시작하기

    • 커멘드 팔레트에서 CMake: Quick Start
    • 프로젝트 이름 입력
    • 커멘드 팔레트에서 CMake: Select a Kit 로 Kit 선택 (툴체인)
    • Project Status 에서 Kit 변경 가능
    • 컴파일러가 보이지 않으면 cmake-tools-kits.json 파일에서 수정 가능. (커멘트 팔레트에서 CMake: Edit User-Local CMake Kits)
  • Select a variant

    • variant : contains a instructions for how to build project
    • default 로 Debug, Release, MinRelSize, RelWithDebInfo build type 을 가짐.
    • Debug: disables optimizations and includes debug info.
    • Release : Includes optimizations but no debug info.
    • MinRelSize : Optimizes for size. No debug info.
    • RelWithDebInfo : Optimizes for speed and includes debug info.
    • 커멘드 팔레트에서 CMake: Select Variant 로 선택 가능
  • kit, variant 선택 했으니 (반드시 해야 함) 커멘드 팔레트에서 CMake: Configure 커멘드 실행해서 프로젝트 build folder 에 build file 생성.

출처 :
https://code.visualstudio.com/docs/cpp/config-wsl
https://code.visualstudio.com/docs/cpp/cmake-linux

profile
복습용 저장소

0개의 댓글