【发布时间】:2022-07-08 16:45:16
【问题描述】:
所以我刚开始学习 C++,我决定使用 Visual Studio Code 作为我的开发环境,并在 macOS 上使用 clang++ 编译器。 我遵循了官方Using Clang in Visual Studio Code 指南,最终得到了以下配置文件:
- tasks.json(编译器构建设置)
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "[mthree] clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
- launch.json(调试器设置)
{
"version": "0.2.0",
"configurations": [
{
"name": "[mthree] clang++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "[mthree] clang++ build active file"
}
]
}
- c_cpp_properties.json(编译器路径和 IntelliSense 设置)
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang++",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64"
}
],
"version": 4
}
现在我的问题与 Intellisense 有关——虽然代码完成/建议工作正常,但我只是看不到任何功能描述。 这是一个简单的例子: No description for the append() function
如果我转到字符串附加函数的定义,它会将我带到 /Library/Developer/CommandLineTools/usr/include/c++/v1/string。是的,这个文件中确实没有任何描述性文档。顶部是这样写的:
// -*- C++ -*-
//===--------------------------- string -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
因此,有谁知道我应该怎么做才能让 Intellisense 显示完整的文档(即用“简单英语”告诉我函数的作用)?
谢谢!
【问题讨论】:
标签: c++ visual-studio-code vscode-settings intellisense clang++