hijkzzz hijkzzz - 1 month ago 30
Linux Question

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

I used VS Linux C ++ development support to create a Linux C ++ project, and then connect Ubuntu remote debugging on Virtualbox. But the console has printed some error messages.

How to make VS2017 correctly print the output of Linux C ++ program?




Environment


  • Windows 10 Pro x64

  • Microsoft Visual Studio Community 2017 15.3.3 - VS Linux C ++ development support

  • Virtualbox 5.1.26

  • Ubuntu 16.04 LTS x64



Step


  • Shift + Ctrl + N

  • Create a new Linux project

  • ConsoleApplication

  • Run

  • Fill out SSH username and password (Ubuntu 16.04 Virtualbox)






main.cpp



#include <cstdio>

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


Console



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

Answer Source

It looks to me like your program ran ok. Have you opened Visual Studio's Linux console? The output you have posted is written to the Output / Debug window, not the console window. Open the Linux console from the Debug menu. Note that it is one of those VS windows that has different position and visibility settings depending on what you are doing (like Find in Files) so you might have to reopen it when you are debugging.

gdb can manage without symbols files so the messages you see are not an error. You'll get less information about what's going on inside the system libraries and, if you really want this, install the debug package from your Linux distro to get the symbols files for libc etc..