我正在使用vs-code调试我的代码,控制台向我显示警告。但是当想要单击警告时,vs-code告诉我找不到我的文件。 我发现它的路径不正确,但是我不知道该在哪里设置。
我安装了c / c ++扩展(0.24.0-insiders2)和vs代码1.35.1。
这是我的settings.json:
{
"files.associations": {
"cstdio": "c"
}
}
tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "g++",
"args": ["-g","${file}","-o","a.out"], // 编译命令
"cwd":"${workspaceRoot}",
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${workspaceRoot}/a.out",
"miDebuggerPath":"C:\\MinGW\\bin\\gdb.exe",
"args": [],
"cwd":"${workspaceRoot}",
"stopAtEntry": false,
"externalConsole": true,
"preLaunchTask": "g++"
}
]
}
和c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\MinGW\\bin\\gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
这是错误消息: 无法打开'_01。线性表顺序存储.c':无法读取文件(错误:找不到文件(c:\ Users \ Xu Bai \ Documents \ vscode_workplace \ c:\ Users \ Xu Bai \ Documents \ vscode_workplace_01。线性表顺序存储.c))。
正确的路径应为“ c:\ Users \ Xu Bai \ Documents \ vscode_workplace_01。线性表顺序存储.c”
那么,我该如何解决这个问题。