我通过更改“launch.json”文件解决了这个问题。我在“配置”字段中更改了“名称”下方的“cwd”值:“(gdb)启动eds”。我将它设置为包含项目的文件夹的绝对路径。下面是我的launch.json 文件。我在 Ubuntu 上使用 VS Code。
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch eds",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build_x86_debug/bin/fcc",
"args": ["-a=${workspaceFolder}/build_x86_debug/bin/", "-d=${workspaceFolder}/build_x86_debug/bin/", "-c=${workspaceFolder}/build_x86_debug/bin/"],
"stopAtEntry": false,
"cwd": "/home/aiden/dev2",
"environment": [{"name": "LD_LIBRARY_PATH", "value": "/usr/lib:${workspaceFolder}/build_x86_debug/bin:${workspaceFolder}/pocolib1.7.5"}],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "Launch",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build_x86/bin/emvadapter",
"cwd" : "/home/vendor",
"env" : { "LD_LIBRARY_PATH":"/home/vendor/lib" }
},
{
"name": "Unit Tests",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build_x86/bin/",
"linux": { "cwd": "${workspaceFolder}/vendor"}
}
]
}