vscode
配置文件核心
-
settings.json:整个vscode的配置,是本地vscode的配置,如果有ssh远程,那么会在远程主机的.vscode-server目录下有settings.json文件,记录给远程主机的独特配置。
-
C_Cpp.intelliSenseEngine 如果关闭了就无法正常跳转…,而且这个功能和clangd会存在冲突. -
{
"workbench.editorAssociations": {
"*.vsix": "default",
"*.md": "vscode.markdown.preview.editor"
},
"files.associations": {
"*.h": "c"
},
"editor.renderControlCharacters": true,
"files.autoGuessEncoding": true,
"editor.minimap.enabled": false,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"git.autofetch": true,
"vsicons.dontShowNewVersionMessage": true,
"terminal.integrated.defaultProfile.windows": "git-bash",
"terminal.integrated.profiles.windows": {
"git-bash": {
"path": "E:\\Git\\bin\\bash.exe",
"args": []
}
},
"C_Cpp.errorSquiggles": "Enabled",
"workbench.iconTheme": "vscode-icons",
"workbench.startupEditor": "none",
"remote.SSH.remotePlatform": {
"ArchLinux": "linux",
"Ubuntu-Tencent": "linux",
"Ubuntu-hl-physical": "linux"
},
"workbench.colorTheme": "Visual Studio Dark - C++",
"editor.formatOnSave": true,
"git.confirmSync": false,
"C_Cpp.intelliSenseEngine": "Default",
"files.autoSave": "onWindowChange",
"editor.formatOnPaste": true,
"editor.defaultFormatter": "ms-vscode.cpptools",
}
-
c_cpp_properties.json:是每一个项目单独的配置,用于配置c/c++的语言标准,linux上面头文件路径,编译器路径等等。
-
执行echo 'main(){}'|gcc -E -v - 查看当前一些标准库头文件在哪儿,然后填入"includePath" -
ubuntu下使用whereis g++就可以找到g++安装的位置了 -
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/lib/gcc/x86_64-linux-gnu/9/include",
"/usr/local/include",
"/usr/include/x86_64-linux-gnu",
"/usr/include"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++11",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.makefile-tools",
"mergeConfigurations": true
}
],
"version": 4
}
-
task.json:编译任务,每一项目单独配置
-
编写makefile时需要注意使用绝对地址,使用相对地址会出问题 -
{
"tasks": [
{
"label": "compile_libet.so",
"type": "shell",
"command": "${workspaceFolder}/compile_env/linux/build.sh debug x64",
"group": {
"kind": "build",
"isDefault": true
},
},
{
"label": "compile_testdemo",
"type": "shell",
"command": "make -f ${workspaceFolder}/test/makefile build",
"group": "test"
}
],
"version": "2.0.0"
}
-
lanuch.json:调试文件,每一个项目单独配置
-
program ,这个路径是编译出来测试程序的路径 -
EasyTools编译出来的库是libet.so,目标vscode的preLaunchTask功能并不支持执行多个任务,所以在使用vscode调试前,请前手动编译出libet.so。需要注意一点,测试程序默认是编译成64位的,所以libet.so也需要编译成64位。 -
{
"version": "0.2.0",
"configurations": [
{
"name": "gdb",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/test/main",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "compile_testdemo"
}
]
}
|