Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    18
    Rep Power
    0
    I have done

    bash-2.03# nm /opt/SUNWspro/prod/lib/CC4/libp/libC.a|grep -i "void __Cimpl::cplus_init()*"
    bash-2.03#
  2. #17
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    18
    Rep Power
    0
    Hi

    Will you explain what is the meaning of output of nm command


    Regards
    Revathi
  4. #18
  5. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,388
    Rep Power
    1871
    There seems to be a general lack of being able to read manual pages.
    http://unixhelp.ed.ac.uk/CGI/man-cgi?nm

    One other point, you have different tools displaying C++ symbols in different styles.

    Some tools display proper C++ names.
    Undefined first referenced
    symbol in file
    cerr ../../../../libs/lib/libgeneral.a(string.o)
    unsafe_ostream::operator<<(long) ../../../../libs/lib/libgeneral.a(string.o)
    operator delete(void*) msggen.o
    Other tools display C++ mangled names
    nm libexpressions.a| grep -i WmExpSimpleNumericFunctionNode
    [131] | 0| 0|NOTY |GLOB |0 |UNDEF |__0feWmExpSimpleNumericFunctionNodeHpreevalR6JRWEStringP6KWmExpStateP6UFilterableCollectionP6JRWOrd eredi
    [132] | 0| 0|NOTY |GLOB |0 |UNDEF |__0feWmExpSimpleNumericFunctionNodeIoptimiseP6KWmExpState
    [147] | 0| 0|FUNC |GLOB |0 |UNDEF |__0oeWmExpSimpleNumericFunctionNodectPCc6IAttrType
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  6. #19
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    18
    Rep Power
    0
    Thanks

    I have went through the Manpages.

    My question is

    http://inst.eecs.berkeley.edu/~selfpace/studyguide/9F.sg/Output/linker.errors.html

    at that link i have read like when. a function call does not find the body during linking it gives error undefined first reference.

    so when i am using
    Code:
     nm libxyz.a 
    [132] | 0| 0|NOTY |GLOB |0 |UNDEF |__adcds
    i felt
    [132] | 0| 0|NOTY |GLOB |0 |UNDEF |__adcds
    maning this is for _adcds if havent found the corrosponding definition it is unresolved

    does it mean like once a lib is formed correctly. it should not give UNDEF in nm command or those unresolved can be resolved when it is linked with other libs??

    I could see in one my

    Code:
    String.C
    #include<stdio.h>
    #include <String.h>
    #include <ctype.h>
    void main()
    {
    cerr<<"";
    }
    when i compiled the code with CC compiler I could see .o file get generated.

    .o is being used in the generation of xyz.a file,.a also generated.


    when i ve seen
    Code:
     nm xyz.a|grep "cerr"
    [44]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [54]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [87]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [22]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [33]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [28]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [33]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [18]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [18]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [239]   |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [39]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [22]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [20]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [31]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [57]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [25]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [48]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [48]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [19]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [18]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [21]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [29]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [30]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [63]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [21]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [72]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    [42]    |         0|       0|OBJT |GLOB |0    |UNDEF  |cerr
    as cerr is function which has to come from header file
    but it is saying UNDEF

    MY dought

    1.if cerr is not in header how code get compiled
    2.does it mean like during linking phase it is looking for function body error thrown,header contains Prototype so during compilation time no error was thrown...
    if 2 is right am i missing any file during linking


    as i could clearly see when i have used 4.3 compiler no issues but 5.8 i am getting this issue

    Regards,
    Revathi.
  8. #20
  9. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,388
    Rep Power
    1871
    The UNDEF's in one library just mean that you need another library to resolve the symbols.

    So when the linker complains about "unresolved symbols", it's really telling you that you're missing a library somewhere.

    The 'nm' tool allows you to see what libraries contain an unresolved symbol, and the library that contains the symbol itself.

    Going back a couple of days, I suggest something like
    nm libgeneral.a | grep -i WmExpSimple
    nm libgeneral.a | grep -i Numeric
    nm libgeneral.a | grep -i FunctionNode
    to see if you can find WmExpSimpleNumericFunctionNode with a spelling mistake.

    If you still can't find it, then look at your build process to see if the source file containing the implementation of WmExpSimpleNumericFunctionNode is actually compiled.

    I feel like I'm going round in circles here.....
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  10. #21
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0
    I am so glad this internet thing works and your article really helped me. Might take you up on that home advice you
  12. #22
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    18
    Rep Power
    0
    Credit goes to salem...

    Thanks once again salem
  14. #23
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    18
    Rep Power
    0
    I ve got error like

    Code:
    Undefined                       first referenced
     symbol                             in file
    void __Cimpl::cplus_init()        (command line)
    _mcount                             /opt/SUNWspro/prod/lib/CC4/libp/libC.a(buffer.o)
    when i have seen
    Code:
     
    nm libC.a|grep "_mcount"

    I know that the reference is undefined i would like to know how can i trace the lib file that i ve to include


    Is there any way i can use some command??
    and see the declaration of it??


    Thanks
    Revathi R
  16. #24
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    18
    Rep Power
    0
    Code:
    void __Cimpl::cplus_init()        (command line)

    here it is not even mentioning the file where the problem is what is the meaning of command line
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo