In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Install and configure VS Code to compile C++ under Ubuntu
Install VS Code
Sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-makesudo apt-get updatesudo apt-get install ubuntu-makesudo umake web visual-studio-code
Then press a to agree directly by default.
Install the plug-in
After opening VS Code, press crtl + shift + P to bring up the command line, and then search for Cellular commands to install the one developed by Microsoft itself.
You can also install the C++ Intellisense plug-in, which is used to automatically complete the code.
Configure launch.json and tasks.json
Note that VS Code can only open the folder where the source code is located, not directly open the source file, otherwise the following will not be possible!
After opening the folder where the source code is located, open the source code in that folder. Press F5 to select C++
Then the launch.json file is automatically generated. There are only two changes needed.
Set
"program": "enter program name, for example\ ${workspaceRoot} / a.out"
Change to
"program": "${workspaceRoot} / a.out"
Set
"cwd": "\ ${workspaceRoot}"
Change to
"cwd": "${workspaceRoot}"
Complete launch.json
{"version": "0.2.0", "configurations": [{"name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceRoot} / a.out", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [] "externalConsole": true, "MIMode": "gdb", "setupCommands": [{"description": "Enable pretty-printing for gdb", "text": "- enable-pretty-printing", "ignoreFailures": true}]}
Then, call up the command line, type Task Runner, and select others
Tasks.json will be automatically generated at this point
Put one of them
"command": "echo"
Change to
"command": "Gmail +"
Set
"args": ["Hello World"]
Change to
"args": ["- g", "${workspaceRoot} / main.cpp"]
Note that the main.cpp here is the same as the source name of your current path.
Complete tasks.json
{/ / See https://go.microsoft.com/fwlink/?LinkId=733558 / / for the documentation about the tasks.json format "version": "0.1.0", "command": "isShellCommand +", "isShellCommand": true, "args": ["- g", "${workspaceRoot} / main.cpp"], "showOutput": "always"}
Run the test
Write a random code
# includeusing namespace std;int main () {cout
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.