我在 Manjaro 上,我已经按照 VS 代码指南在 Linux 上安装 C++,它已经成功构建并运行了一个 hello world 应用程序和我构建的其他应用程序,但我发现的问题是,无论何时我正在调试并点击“Step into”cout
或 cin
我收到以下错误消息:
Unable to open 'ios_base.h': Unable to read file '/build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ios_base.h' (Error: Unable to resolve non-existing file '/build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ios_base.h').
Unable to open 'ostream.tcc': Unable to read file '/build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ostream.tcc' (Error: Unable to resolve non-existing file '/build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ostream.tcc').
当我单击“创建文件”时,会显示以下消息:
Unable to write file '/build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ostream.tcc' (NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/build')
Unable to write file '/build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/ios_base.h' (NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/build')
我已经搜索了 ios_base 文件和 ostream 文件,并在 /usr/include/c++/11.1.0/ 中找到了它们,我知道我可以毫无问题地运行 cout
和 cin
操作只是试图进入它们会导致错误。
这里也是我的 Task.json 文件,因为我看到一些帖子讨论过它。
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "g++ build active file",
"command": "/usr/bin/g++",
"args": ["-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}"],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}```