如何在c++11中使用vscode clangd
How to use vscode-clangd with c++11?
如何配置vscode clanggd以使用c++11进行lint?
我在车间添加了complie_commands.json
和complie_flags.txt
。
workshop
|-complie_commands.json
|-complie_flags.txt
|-list.cpp
compile_commands.json
[
{ "directory": "pathto/workshop/",
"command": "/opt/rh/llvm-toolset-7/root/usr/bin/clang++ -o file *cpp -std=c++11"}
]
compile_flags.txt
-std=c++11
无法识别auto
,错误为:
'auto' type specifier is a C++11 extension
将c_cpp_properties.json中的cppStandard
设置为c++11
。例如:
{
"env": {
"myDefaultIncludePath": ["${workspaceFolder}", "${workspaceFolder}/include"],
"myCompilerPath": "/usr/local/bin/gcc-7"
},
"configurations": [
{
"name": "Linux",
"intelliSenseMode": "clang-x64",
"includePath": ["${myDefaultIncludePath}", "/another/path"],
"macFrameworkPath": ["/System/Library/Frameworks"],
"defines": ["FOO", "BAR=100"],
"forcedInclude": ["${workspaceFolder}/include/config.h"],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++11",
"compileCommands": "/path/to/compile_commands.json",
"browse": {
"path": ["${workspaceFolder}"],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
相关文章:
- vscode g++链路故障:体系结构x86_64的未定义符号
- VSCode-有一个红色下划线,但程序构建和运行正确,并且出现配音错误
- 当使用带有VS2019或VSCode的虚幻引擎4.24.2时,我如何修复这些错误的Intellisense错误
- vscode下的Arduino代码出现意外编译错误
- 如何使用Clang/GCC在Mac上为C/C++设置VSCode
- 使用vscode调试时,GDB意外退出
- VSCode C++ 编译的exe感染了Win32:TrojanX-gen[Trj]
- VSCode IntelliSense无法识别SDL框架的SDL_image扩展库
- VSCode - C++ - MinGW 编译器的问题
- VSCode C/C++ Intellisense issue: Undefined identifiers (Linu
- VSCode 中带有 C/C++ 扩展名的多行注释缩进错误
- 在 vscode 中运行时无法暂停或设置断点
- VSCode 说 std::chrono 是模棱两可的,如果运算符<<重载
- 如何在 VSCODE 中设置项目文件夹并链接所有 CPP 文件
- 我似乎无法让 msvc 链接器在 vscode 上正常工作
- VSCode C++终端进程已终止,退出代码为:1
- 如何在添加文件的情况下在VSCode中调试C++程序
- 将 clangd stderr 重定向到文件而不是控制台
- VSCode中的Clangd:.clang格式和.clang整洁文件
- 如何在c++11中使用vscode clangd