In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
The editor would like to share with you an example of how to configure the vscode development environment. I hope you will get something after reading this article. Let's discuss it together.
1. Install the cpptools tool
Open vscode and follow the steps shown in the figure to install
2. Download MinGW
Download address: https://sourceforge.net/projects/mingw-w64/files/
Downloaded file: after entering the website, do not click "Download Lasted Version", slide down to find the latest version of "x86_64-posix-seh".
Install MinGW: download a 7z zip file, unpack it and move it to the location you want to install. My installation location is: d:\ 2Software\ mingw64
3. Configure environment variables
Configuration object: WinGW, copy the path where you just installed WinGW
Configure environment variables: take win10 as an example and follow the steps shown in the figure
Restart VScode after configuring the environment variables.
4. Verify whether the environment variables are configured successfully.
Press win + R, enter cmd, enter after enter, enter enter, and then enter. If prompted with the following information [1], the environment variable is configured successfully. If the following information [2] is prompted, the configuration of the environment variable fails.
[1]: galleys: fatal error: no input files
[2]: 'gapproved commands' is not an internal or external command, nor is it a runnable program or batch file.
5. Configure the C++ environment with a simple .cpp file.
Create a new empty folder Code
Open VScode-- > Open folder-- > Select the folder you just created Code
Create a new test.cpp file (take the simplest HelloWorld.cpp as an example)
Enter the debugging interface to add the configuration environment, select C++ (GDB/LLDB), and then select g++.exe, after which the launch.json configuration file will be automatically generated.
Edit launch.json profile
{"version": "0.2.0", "configurations": [{"name": "g++.exe build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\ ${fileBasenameNoExtension} .exe", "args": [] "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, / / modify this item Let the terminal "MIMode": "gdb", "miDebuggerPath": "D:\\ 2Software\\ mingw64\\ bin\\ gdb.exe", "setupCommands": [{"description": "Enable pretty-printing for gdb", "text": "- enable-pretty-printing" "ignoreFailures": true}], "preLaunchTask": "task gaming +" / / modify this item}]}
Return to the .cpp file, press F5 to debug, the task "task gathers +" will pop up, select "configure Task", and the tasks.json file will be generated automatically.
Edit the tasks.json file
{"version": "2.0.0", "tasks": [{"type": "shell", "label": "task command +", / / modify the entry "command": "D:\\ 2Software\\ mingw64\\ bin\\ g++.exe", "args": ["- g" "${file}", "- o", "${fileDirname}\\ ${fileBasenameNoExtension} .exe"], "options": {"cwd": "D:\\ 2Software\\ mingw64\\ bin"} "problemMatcher": ["$gcc"], "group": "build"}}
[note]: the value of "preLaunchTask" in the launch.json file must be consistent with the value of "label" in the tasks.json file. The setting of the value depends on personal preference, and the default value is also OK.
6. Run
Return to the HelloWorld.cpp file, press F5 to debug, and find that it is completely OK!
After reading this article, I believe you have a certain understanding of the "example of vscode configuration cswab + development environment". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!
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: 202
*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.