๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ‘จ‍๐Ÿš€ | OTHERS

VSCODE C/C++ ์ปดํŒŒ์ผ ์„ธํŒ… (ํ—ค๋”ํŒŒ์ผ ์ถ”๊ฐ€ ๊ฐ€๋Šฅ) for Mac

by KASSID 2022. 3. 5.

๋ชฉ์ฐจ

    728x90

    0. extension ์„ค์น˜

    - C/C++

    - CodeLLDB

    1. launch.json

    {
        "version": "0.2.0",
        "configurations": [
            {
                "type": "lldb",
                "request": "launch",
                "name": "Launch",
                "program": "${fileDirname}/${fileBasenameNoExtension}.o",
                "args": [],
                "preLaunchTask": "g++",
                "terminal": "integrated"
            }
            
        ]
    }

     

    2. tasks.json

    {
        "tasks": [
            {
                "type": "shell",
                "label": "g++",
                "command": "g++",
                "args": [
                    "-g",
                    //1. ํ—ค๋”ํŒŒ์ผ ํฌํ•จํ•˜๊ณ  ์‹ถ์„ ๋•Œ
                    // "${fileDirname}/*.cpp",
    
                    //2. ๊ทธ๋ƒฅ ํŒŒ์ผ๋งŒ ์ปดํŒŒ์ผํ•˜๊ณ  ์‹ถ์„ ๋•Œ
                    "${file}",
    
                    "-o",
                    "${fileDirname}/${fileBasenameNoExtension}.o", //ํŒŒ์ผ ๋นŒ๋“œ, ์‹คํ–‰
    
                ],
                "options": {
                    "cwd": "${workspaceFolder}"
                },
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "presentation": {   //Explained in detail below
                    "echo": false,
                    "reveal": "always",
                    "focus": true,
                    "panel": "shared",
                    "clear": false,
                    "showReuseMessage": false
                },
                "problemMatcher": [
                    "$gcc"
                ]
            }
        ],
        "version": "2.0.0"
    }

    ์ด ํ—ค๋”ํŒŒ์ผ ์ถ”๊ฐ€ ๋•๋ถ„์— ์•„์ฃผ ๋จธ๋ฆฌ๊ฐ€ ์ง€๋ˆ์ง€๋ˆ ์•„ํŒ ๋‹ค...

    ๊ทธ๋ž˜๋„ ํ•ด๊ฒฐ!

    3. settings.json

    {
        "explorer.sortOrder": "type",
        "files.exclude": {
            "**/*.o": true,
            "**/*.dSYM": true,
        },
        "C_Cpp.errorSquiggles": "Disabled",
        
    }

     

    ํƒ์ƒ‰๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์ง€์ €๋ถ„ํ•ด์„œ ์ •๋ฆฌ์šฉ

     

    4. c_cpp_properties.json

    {
        "configurations": [
            {
                "name": "Mac",
                "includePath": [
                    "${workspaceFolder}/**"
                ],
                "defines": [],
                "macFrameworkPath": [
                    "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
                ],
                "compilerPath": "/usr/bin/g++",
                "cStandard": "c17",
                "cppStandard": "c++98",
                "intelliSenseMode": "macos-clang-x64"
            }
        ],
        "version": 4
    }

    ๋Œ“๊ธ€