首页 文章

Visual Studio 2017 for Linux C:“无法找到或打开符号文件”

提问于
浏览
0

我使用VS Linux C开发支持来创建Linux C项目,然后在Virtualbox上连接Ubuntu远程调试 . 但控制台已经打印了一些错误消息 .

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


环境

  • Windows 10 Pro x64

  • Microsoft Visual Studio社区2017 15.3.3 - VS Linux C开发支持

  • Virtualbox 5.1.26

  • Ubuntu 16.04 LTS x64

  • Shift Ctrl N.

  • 创建一个新的Linux项目

  • ConsoleApplication

  • 填写SSH用户名和密码(Ubuntu 16.04 Virtualbox)


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)。

2 回答

  • 2

    它看起来像你的程序运行正常 . 你打开过Visual Studio的Linux控制台吗?您发布的输出将写入“输出/调试”窗口,而不是控制台窗口 . 从“调试”菜单中打开Linux控制台 . 请注意,它是具有不同位置和可见性设置的VS窗口之一,具体取决于您正在执行的操作(如在文件中查找),因此您可能必须在调试时重新打开它 .

    gdb 可以在没有符号文件的情况下进行管理,因此您看到的消息不是错误 . 你'll get less information about what'在系统库内部进行,如果你真的想要这个,请从Linux发行版安装调试包以获取libc的符号文件等 .

  • 0

    这可能是一个权利问题 . 尝试从Visual Studio附加到正在运行的应用程序 . 我收到此错误:无法启动调试 . 由于没有足够的权限而错误消息'ptrace:不允许操作',因此使用GDB附加到进程4626失败 .

    请参阅此处以解决ptrace错误:Qt Creator, ptrace: Operation not permitted. What is the permanent solution?

相关问题