• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

저번에 VS code 실행이 안된다고 글 남긴 수강생입니다......

24.02.21 15:57 작성 조회수 114

1

교수님께서 말씀하신 깃허브 내용대로 c/c++ runner도 깔고 json 코드도 일부 수정했는데 여전히 실행이 안됩니다 뭐가 문제일까요.....아래에 launch.json 코드도 남기겠습니다. 그리고 말씀하신 xcode가 xcode-select 말씀하시는 거면 깔려있습니다.

 

제발 뭐가 문제인지 알고 싶네요 ㅜㅜ 초보라서 아직 개발 환경 설정 이런 데는 정말 다루기가 어렵습니다.....

 

<launch.json>

   "version": "0.2.0",

    "configurations": [

 

        {

        "type": "lldb",

        "request": "launch",

        "name": "Debug",

        "program": "${workspaceFolder}/<executable file>",

 

 

        "args": ["-std=c++17"],

        "cwd": "${workspaceFolder}"

        },

        {

        "name": "C/C++ Runner: Debug Session",

        "type": "lldb",

        "request": "launch",

      "args": ["-std=c++17"],

      "cwd": "/Users/brian/Downloads/Visual Studio Code 2.app/Contents/Practice",

      "program": "/Users/brian/Downloads/Visual Studio Code 2.app/Contents/Practice/build/Debug/outDebug"

 

<c_cpp_properties>

"configurations": [

        {

            "name": "macos-clang-x64",

            "includePath": [

                "${workspaceFolder}/**"

            ],

            "compilerPath": "/usr/bin/clang",

            "cStandard": "c17",

            "cppStandard": "c++17",

            "intelliSenseMode": "macos-clang-x64",

            "compilerArgs": [

                ""

            ]

        }

    ],

    "version": 4

}

답변 1

답변을 작성해보세요.

1

Soobak님의 프로필

Soobak

2024.02.22

안녕하세요, 질문&답변 도우미 Soobak 입니다.

 

launch.json 파일에서 "program": "${workspaceFolder}/<excutablefile>" 부분에서, <excutablefile> 부분을 실제 빌드된 실행 파일의 이름으로 변경해보세요.


예를 들어, a.out 이라면, "program": "${workspaceFolder}/a.out" 으로 설정해야 합니다.

혹은, "program": "${workspaceFolder}/${fileBasenameNoExtension}", 으로 변경해보세요.

 

"version": "0.2.0",

    "configurations": [
        {
        "type": "lldb",
        "request": "launch",
        "name": "Debug",
        "program": $${workspaceFolder}/{fileBasenameNoExtension}",
        "cwd": "${workspaceFolder}"
        },
        {
        "name": "C/C++ Runner: Debug Session",
        "type": "lldb",
        "request": "launch",
      "cwd": "/Users/brian/Downloads/Visual Studio Code 2.app/Contents/Practice",
      "program": "/Users/brian/Downloads/Visual Studio Code 2.app/Contents/Practice/build/Debug/outDebug"

 

위와 같이 한 번 변경해보세요,

 

XCode 관련해서, xcode-select 가 설치되셨다면, 터미널 창에서 xcode-select --install 을 입력하셔서 필요한 도구가 모두 설치되었는지 확인해보세요.

 

만약, 계속 .json 파일 설정하시는 것이 어렵다고 느껴지신다면,
각각의 KEY 값들이 무엇을 의미하는 것인지 익숙해지실 때 까지는, 당분간 터미널창에 직접 clang main.c , ./a.out (혹은, 한 번에 clang main.c && ./a.out )등의 명령어로 직접 컴파일 후 실행해보시는 방법도 추천 드려봅니다.

 

환경 설정 관련 문제가 참 복잡하고 어려운데, 보다 적극적으로 도와드리지 못하는 점이 아쉽네요.

부디, 이번에는 잘 진행되셨으면 좋겠습니다.

어려움이 있으시면 편히 댓글남겨주세요.