Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C Visual Studio代码忽略调试符号_C_Linux_Gcc_Visual Studio Code - Fatal编程技术网

C Visual Studio代码忽略调试符号

C Visual Studio代码忽略调试符号,c,linux,gcc,visual-studio-code,C,Linux,Gcc,Visual Studio Code,我试图在Mint VM上使用visual studio代码调试C,代码如下: #include <stdio.h> int main(int numargs, char* argvector[]) { printf("test\n"); return(0); } { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch",

我试图在Mint VM上使用visual studio代码调试C,代码如下:

#include <stdio.h>

int main(int numargs, char* argvector[])
{
   printf("test\n");
  return(0);
}
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/grow",
            "processName": "grow",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
             ]
        }
    ]
}
根据ls-l的输出,我可以验证gcc是否正在添加符号。 当我尝试使用C/C++扩展使用vs代码调试此程序时,收到以下错误:

Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
Stopped due to shared library event (no libraries added or removed)
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
Breakpoint 1, main (numargs=1, argvector=0x7fffffffdd18) at test.c:5
5     printf("test\n");
[Inferior 1 (process 8322) exited normally]
The program '/home/ccsd/test/test' has exited with code 0 (0x00000000).
gcc版本:5.4.0 20160609

vs-c版本:1.24.1

我的launch.json文件如下:

#include <stdio.h>

int main(int numargs, char* argvector[])
{
   printf("test\n");
  return(0);
}
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/grow",
            "processName": "grow",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
             ]
        }
    ]
}
您可能会注意到,这不是的副本,因为我已经在使用-g开关

我想知道我怎样才能解决这个问题。提前感谢。

假设使用
启动.json的
“additionalSOLibSearchPath”
选项没有帮助,以下设置可能会将共享库添加到
gdb
中:

"setupCommands":[
    {
        "description": "Additional libs for gdb",
        "text": "set solib-search-path sharedLibraryPath/lib"
    }
]

PS:
gdb
仍可能由于共享库事件(未添加或删除库)而引发
停止
警告。

这有帮助吗?不是真的,根据我的阅读,我的launch.json文件应该已经符合guy找到的解决方案,我似乎在launch中遇到了与他相同的错误,但没有修复,并且我在使用attach时遇到了相同的错误。将编译器和VSC版本添加到你的post.done中,还添加了my launch.json。我建议您最好从github.com/Microsoft/vscode-cpptools/issues页面开始。如果你最终在那里得到了答案,请圈回来,在这里回答你自己的问题。