Visual Studio 2017 年 Linux C++:"Cannot find or open the symbol file"

Visual Studio 2017 for Linux C++ : "Cannot find or open the symbol file"

我用VSLinuxC++开发支持创建了一个LinuxC++项目,然后在Virtualbox上连接Ubuntu远程调试。但是控制台打印了一些错误信息。

如何让VS2017正确打印Linux C++程序的输出?


环境

步骤


main.cpp

#include <cstdio>

int main()
{
    printf("hello from ConsoleApplication1!\n");
    return 0;
}

控制台

=thread-group-added,id="i1"
GNU gdb (GDB) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
Loaded 'shared libraries loaded at this time.'. Cannot find or open the symbol file.
Stopped due to shared library event:
  Inferior loaded /lib/x86_64-linux-gnu/libc.so.6
    /lib64/ld-linux-x86-64.so.2
Loaded '/lib/x86_64-linux-gnu/libc.so.6'. Cannot find or open the symbol file.
Loaded '/lib64/ld-linux-x86-64.so.2'. Cannot find or open the symbol file.
[Inferior 1 (process 14481) exited normally]
程序“”已退出,返回值为 0 (0x0)。

我觉得你的程序很像 运行 好的。您是否打开了 Visual Studio 的 Linux 控制台?您发布的输出被写入输出/调试 window,而不是控制台 window。从“调试”菜单打开 Linux 控制台。请注意,它是那些具有不同位置和可见性设置的 VS windows 之一,具体取决于您正在做什么(例如在文件中查找),因此您可能需要在调试时重新打开它。

gdb 可以在没有符号文件的情况下进行管理,因此您看到的消息不是错误。您将获得较少的有关系统库内部情况的信息,如果您真的想要这个,请从您的 Linux 发行版安装调试包以获取 libc 等的符号文件。

可能是权限问题。尝试从 Visual Studio 附加到 运行 应用程序。我收到此错误:无法开始调试。由于权限不足,使用 GDB 附加到进程 4626 失败并显示错误消息 'ptrace: Operation not permitted.'.

解决ptrace错误见这里: Qt Creator, ptrace: Operation not permitted. What is the permanent solution?