vscode configuration c language development and debugging environment on mac

Xcode dumping problem on the computer, and thought they write code to go back to the original vscode often use simple record about the configuration process. Referring to the specific configuration here .
First Quguan network download vscode mac version of the installation package, the installation is completed after the restart vscode, shift + command + X button in the search box to search c \ c ++ installation c \ c ++ plug-ins.
Then create a new project folder, open the folder, the new .c file and save it in a folder. Then three json file configuration.
1.c_cpp_properties.json file
using the shortcut command + shift + p command line to open the panel, enter the edit configurations, the pop-up list, select C with the JSON / C ++: Edit Configurations (JSON ), automatically creates .vscode configuration folder and c_cpp_properties.json file, the configuration file as follows: wherein clang version 10.0.1 through the finder command + shift + G route search / Library / Developer / CommandLineTools / usr / lib / clang obtained.

//c_cpp_properties.json文件
{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "/Library/Developer/CommandLineTools/usr/include/c++/v1",
                "/usr/local/include",
                "/Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/include",
                "/Library/Developer/CommandLineTools/usr/include",
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

2. tasks.json file
+ shift + p, enter vscode in command in the command line panel tasks: configure task, choose Tasks: Configure Task, clickC/C++:gcc build active fileTasks.json automatically generated file. That is to configure the args field, I did not configuration can also be used, such as a problem and then study it ==
3.launch.json file
open command-line panel command + shift + P, enter the launch, choose Open launch.json, select environment for C ++ (GDB / LLDB), generate launch.json files easily debug! !

There is one final question! ! When debugging can not find where to enter, vscode terminal is shown below edit only! ! Then remember to launch.json fileexternalConsoleModify the propertytrueYou will be able to debug a pleasant! !
Here Insert Picture Description
Then you can start to write a pleasant spicy chicken Codes friends ~ command + shishift + b compile, then fn + f5 can debug a pleasant ==

Released two original articles · won praise 0 · Views 49

Guess you like

Origin blog.csdn.net/weixin_44091012/article/details/104328087