How can I view symbols in a .o file? nm does not work for me. I use g++/linux.
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
There is a command to take a look at which functions are included in an object file or library or executable:
Instead of
nm
, you can use the powerfulobjdump
. See the man page for details. Tryobjdump -t myfile
orobjdump -T myfile
. With the-C
flag you can also demangle C++ names, likenm
does.Just run:
nm you_obj_file.o | c++filt
Have you been using a cross-compiler for another platform? If so, you need to use the respective
nm
orobjdump
commmand.For example, if you have used
XXX-YYY-gcc
to compile the .o file, you need to useXXX-YYY-nm
orXXX-YYY-objdump
to process the files.You can use
nm -C .o/lib/exe
, for example:using
nm -C
it will be more readable, if you just usenm
:as we see it's not so readable.
Below is what my
file1.cpp
like: