c++ - 适用于 Linux C++ 的 Visual Studio 2017 : "Cannot find or open the symbol file"

标签 c++ linux gcc visual-studio-2017

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

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


环境

  • Windows 10 专业版 x64
  • Microsoft Visual Studio Community 2017 15.3.3 - VS Linux C++ 开发支持
  • Virtualbox 5.1.26
  • Ubuntu 16.04 LTS x64

步骤

  • Shift + Ctrl + N
  • 创建一个新的 Linux 项目
  • 控制台应用程序
  • 运行
  • 填写 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)。

最佳答案

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

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

关于c++ - 适用于 Linux C++ 的 Visual Studio 2017 : "Cannot find or open the symbol file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46127228/

相关文章:

c++ - 创建一个类模板 std::is_swappable

python - Quantlib 1.14 和 Quantlib1.14-SWIG : versions of Visual C++ prior to VC++10 (2010) are no longer supported

c++ - 为arm编译qwt

linux -/etc/passwd 上是否存在所有 linux 用户?

linux - 如何正确更改 Microsoft Azure 中的 SSH 端口?

macos - 将 Homebrew 与备用 GCC 一起使用

c++ - 比较两个 QColor 对象的颜色

c++ - 如何从函数返回具有多个值的数组? C++

c++ - GCC、Unicode 和 __FUNCTION__

gcc - 如何让 gcc 显示调用的内部命令?