How can I view symbols in a .o file? nm does not work for me. I use g++/linux.
You can use nm -C .o/lib/exe
, for example:
xiongyu@ubuntu:~/tmp/build$ nm -C libfile1.a
file1.cpp.o:
0000000000000000 T f()
0000000000000000 W int fun(int)
using nm -C
it will be more readable, if you just use nm
:
xiongyu@ubuntu:~/tmp/build$ nm libfile1.a
file1.cpp.o:
0000000000000000 T _Z1fv
0000000000000000 W _Z3funIiET_S0_
as we see it's not so readable.
Below is what my file1.cpp
like:
xiongyu@ubuntu:~/tmp/build$ vi ../file1.cpp
#include "head.h"
void f() {
int i = fun(42);
}