当前位置:网站首页>Win10 vscode code code format setting and remote breakpoint debugging
Win10 vscode code code format setting and remote breakpoint debugging
2022-07-27 11:20:00 【lqw198421】
background
The company's code style is Google, Automatic format is required ; Wen long and Li Ze are in linux and windows Set up under , I refer to Li Ze's win10 Under the settings , As a result, I stepped into a big hole , Wasted a whole day ;
The process
The setting process provided by Li Ze :
1. download
Download from the official website vscode https://code.visualstudio.com/
—— Key points : This is where I stepped on the big hole , Due to corporate network problems , Downloading from the official website always fails , So I downloaded a green version from other websites without installation ; As a result, the following formatting settings always prompt that they cannot be found clang, Even if I install it manually LLVM And add it to the environment variable , Can be in win10 Of cmd Under normal execution , but vscode Still keep reminding that I can't find ;
Restart the computer + Uninstall and reinstall the plug-in + reinstall vscode, It can't solve this problem (dog head), A whole day is wasted on different attempts ; Even tried to download the plug-in and install it manually , Nor has it solved this problem ;
2.Vscode plug-in unit
Atom one dark thme Interface theme
Batter comments notes
Bracket pair colorizer Bracket highlight color
c/c++ Grammar tip
Chinese chinese
Cmake cmake grammar
Cmake tools cmake Expansion pack,
Path intellisense Path reminder
Surround Add tags
TODO highlitht todo The highlighted
Visual studio intellicode Grammar tip
Tabinne autocomplete ai Grammar tip ( Based on historical records )
Vscode-fileheader Header file signature
Korofileheader Function Comments
Remote ssh long-range ssh Connect
Remote wsl Connect linux
Remote containers
Remote development
3.Vscode and docker Connect
Server side -docker Containers : yum install -y openssh-server
Before that , Already in docker Installed on
cmake3:
yum install -y cmake3
gcc:
sudo yum install centos-release-scl centos-release-scl-rh
sudo yum install -y scl-utils*
sudo yum -y install llvm-toolset-7 devtoolset-8-gcc*
scl enable devtoolset-8 bash perhaps source /opt/rh/devtoolset-8/enable
which gcc
gcc –version
1) modify docker Container of ssh visit
A、vi Server side /etc/ssh/sshd_config
B、 hold PasswordAuthentication set yes
C、 find #PermitRootLogin no Change it to PermitRootLogin yes
2)systemctl restart sshd
3)win10 Next, verify whether you can connect to docker
ssh [email protected] -p yyyyy
For me , Namely ssh [email protected] -p 11001 , there 11001 yes docker Mapping port number on
4. Vscode Connect linux Containers
double-click vscode Left side “ Remote Explorer ”( The steps in the figure below 1), And then click “+”( step 2) create profile , for example :
Set up config file :
And enter the contents in the document :
Host 127.0.0.1
HostName 127.0.0.1
Port 11001
User root
【 Here you can configure multiple linked 】
Then double click , Then enter the password , You can connect to docker On ;
stay vscode through docker To find and open the corresponding project : Open in folders ;
.clang-format( Code specification script , Under the root directory of the project )
You can make corresponding modifications according to your own needs , Some modifications may need to be made in vscode Make corresponding settings in the settings of , Setting of specific options , After the treatment to the problem, search ; For example, I use vscode Green installation free version of , As a result, the formatting settings do not work together , Even if it is modified vscode Many options in ; These small pits still need attention ;
---
Language: Cpp
BasedOnStyle: Google
DerivePointerAlignment: false
PointerAlignment: Left
BinPackArguments: false
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: None
ContinuationIndentWidth: 2
ConstructorInitializerIndentWidth: 2
...
Breakpoint debugging
Generate .vscode Folder
Just click vscode The debugging button on the left , It will be generated in the root directory of the project .vscode Folder , The following files are : extensions.json launch.json settings.json tasks.json
launch.json To configure
The contents are as follows , Some contents need to be modified according to the project or local settings :
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) start-up ",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/tcp_filter", // Need modification - Debug the path of the executable
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",// Need modification -gdb The path of
"setupCommands": [
{
"description": " by gdb Enable neat printing ",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "make"
}
]
}
tasks.json To configure
The contents are as follows , Some contents need to be modified according to the project or local settings (eg:command The corresponding part ):
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make",
"type": "shell",
"command": "make", //sh build.sh
"group": {
//group Express ‘ Group ’, We can have a lot of task, And put them in a ‘ Group ’ in
"kind": "build", // Indicates that this set of task types is build
"isDefault": true // Indicates that this task is the default task in the current group of tasks
},
}
]
}
extensions.json To configure
{
"recommendations": [
"xaver.clang-format",
"ms-vscode.cpptools"
]
}
Be careful
During the commissioning of other subsequent projects , Found a small hole , If you want to pass vscode To debug remotely docker Mapping to local projects , When opening the file to create the project , Not directly in windows Next, open the file , It should be in docker Of linux Enter the corresponding directory under the directory to open the file and establish the project , otherwise vscode Think of it as a windows The next project , So in search gdb When , Will be in windows Look for , Not in docker Of linux Look for ;
summary
1、 A small pit may take a day or even longer , And there is no satisfactory solution on the Internet , For example, I met this time vscode Problems caused by green installation free version ;
2、 Try to understand the reason for every problem , Then try to solve it accordingly ; There's really no move , Try to kill the old master with random fists ;
边栏推荐
- SQL Server2000数据库错误
- Miscellaneous records of Finance
- What changes will metauniverse bring to the music industry in the trillion market?
- 2022牛客多校训练(3)A-Ancestor 题目翻译
- Shock simulation of engine mounting system transient modal dynamic analysis and response spectrum analysis
- Openatom openharmony sub forum, see you today at 14:00! Wonderful release of memorabilia attached
- 01 BTC cryptology principle
- Internal and external troubles of digital collection NFT "boring ape" bayc
- 背包模型 AcWing 423. 采药
- Non progressive phenomena of entropy and morphology
猜你喜欢

Real time development platform construction practice, in-depth release of real-time data value - 04 live broadcast review

Wilderness search --- search iterations

Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?

SQL Server2000 database error

How to build a real-time development platform to deeply release the value of enterprise real-time data?

数字三角形模型 AcWing 1027. 方格取数

ethereum rpc

The difference of iteration number and information entropy

Internal and external troubles of digital collection NFT "boring ape" bayc

Play with the cluster configuration center and learn about the Taier console
随机推荐
State compression DP acwing 91. shortest Hamilton path
49字母异位分组和242有效的字母异位词
Derivation of the detailed expansion sto overlap integrals
12 is at least twice the maximum number of other numbers
properties文件
Sorry, you guys have something to deal with in the bank recently, which has been delayed
Thank you for your likes and attention
How to build a data index system is the most effective. From 0 to 1, we will take you a quick start - 02 live review
Shortest moving distance and entropy of morphological complex
最长上升子序列模型 AcWing 1014. 登山
SQL Server2000 database error
10 complete half of the questions
An article reveals the NFT strategy of traditional game manufacturers such as Ubisoft
泰山OFFICE技术讲座:缩放比例与打开文件
2022 Niuke multi school training (3) a-ancestor topic translation
I've compromised. Since everyone wants to call me Yelin, there's nothing I can do
What changes will metauniverse bring to the music industry in the trillion market?
MySQL installation (RPM package)
背包模型 AcWing 1022. 宠物小精灵之收服
最长上升子序列模型 AcWing 1012. 友好城市