【发布时间】:2020-02-01 00:39:06
【问题描述】:
我正在使用 Visual Studio Code 在 C++ 中进行开发,我注意到,当程序构建失败时,我无法通过单击快速访问“问题”选项卡中显示的错误行,因为 VS代码尝试以错误的路径读取文件,然后认为该文件不存在。下面的例子:
如您所见,就像 VS Code 总是在 ${workspaceFolder}/${workspaceFolder}/ 中搜索文件,而它实际上应该在 ${workspaceFolder} 中/。是否有任何配置区域可供我检查和修复此问题?
这是我的 c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/SFML-2.5.1/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\MinGW\\bin\\g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x86",
"browse": {
"path": [
"C:/SFML/SFML-2.5.1/include"
]
}
}
],
"version": 4
}
这是 tasks.json 中的构建任务:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Build BASIC Debug",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"${workspaceFolder}\\mainBASIC.cpp",
"-o",
"${workspaceFolder}\\bin-debug\\DaniHash_BASIC 1.0.3d.exe",
"-IC:\\SFML-2.5.1\\include",
"-LC:\\SFML-2.5.1\\lib",
"-lsfml-graphics-d",
"-lsfml-window-d",
"-lsfml-system-d",
],
"options": {
"cwd": "C:\\MinGW\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
}
}
【问题讨论】: