nm: "U" The symbol is undefined

An undefined symbol is a symbol that the library uses but was not defined in any of the object files that went into creating the library.

Usually the symbol is defined in another library which also needs to be linked in to your application. Alternatively the symbol is undefined because you've forgotten to build the code that defines the symbol or you've forgotten to include the object file with that symbol into your library.

In your case it looks like a symbol from your implementation's C library so you would expect that to be undefined in your own library. It will be defined in your libc.so wherever that is, possibly /usr/lib.


Deciphering this could be done like this :

           U _ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4

Means:

    U->>> in your library its undefined

what is undefined ?

     _ZNSs4_Rep20_S_empty_rep_storageE

Where it is likely to find it ?

      GLIBCXX_3.4

Now for your question : " Why is it undefined : ", Its because The linker is not able to find its definition

Second Part : "If its undefined why report at all ", , nm utility shall read the whole symbol table of your lib and print it. So, its just reading & printing it without applying any operations on it.