In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to configure the cpp debugging environment for vscode. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Install the plug-in Candlestick +
Open the plugin page, search for Cmax Candle + search for Cmax Candle + plug-in.
After you install the plug-in, when you use vscode to open the folder that contains the cpp file, vscode adds the .vscode subfolder to the directory.
Add c_cpp_properties.json configuration
Run C/Cpp: Edit configurations with the shortcut key ⇧⌘ P to add the missing c_cpp_properties.json file. The default added files are as follows:
{"configurations": [{"name": "Mac", "includePath": ["${workspaceFolder} / * *"], "defines": [] "macFrameworkPath": ["/ Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks"], "compilerPath": "/ usr/bin/clang", "cStandard": "c11", "cppStandard": "centering 17" "intelliSenseMode": "clang-x64"}], "version": 4}
No adjustments have been made to this part. The file is added by default.
Add tasks.json profile
Use the shortcut key ⇧⌘ P to select the command to execute, select the Task: Configure Task command, select Create tasks.json from templates, and select Others to create an external command. Change the commnd option according to your compiler.
{/ / See https://go.microsoft.com/fwlink/?LinkId=733558 / / for the documentation about the tasks.json format "version": "2.0.0", "tasks": [{"label": "cpp", "type": "shell", "command": "args +", "args": ["- g" "${file}", "- o", "a.out"], "group": {"kind": "build", "isDefault": true}]}
One thing to say here is that you want to compile and execute the code for the current tab, so you use ${file} in the args parameter. Another point to say is that debugging will be affected if you do not specify the compiled file for the output.
> > Gmail +-g question.cpp-o a.out
Of course, you can also replace the a.out in args with ${file} to keep the correspondence with the file name.
Add launch.json profile
Click run in the debug interface and you will be prompted to add a launch.json configuration file. It defines the relevant properties of the startup debug file.
{/ / use IntelliSense to learn about the relevant properties. / / hover to see a description of an existing property. / / for more information Please visit https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [{"name": "(lldb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder} / a.out", "args": [] "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "lldb", "preLaunchTask": "cpp"]}
There are three parameters to be explained here:
1. Program parameter. The file name here should correspond to the previous one. If you used a.out before, it should also be a.out.
2. ExternalConsole parameters, hovering over it will say that if it is a system such as linux, when it is set to false, the printed content will be output in the vscode integration. If it is true, it will be output on the external terminal. To see the output in vscode, set it to false. Another thing to pay attention to is the parameter externalConsole. Hovering over it will say that if it is a system such as linux, when it is set to false, the printed content will be output in the vscode integration. If it is true, it will be output on the external terminal. To see the output in vscode, set it to false here.
3. PreLaunchTask parameter, because the code needs to be compiled in advance for each debugging, here you can specify the compilation task through the preLaunchTask parameter. It is designated here as the previous task: cpp. That is, the content in the label of the previous task.
This is the end of this article on how to configure the cpp debugging environment for vscode. I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.