C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old December 26th, 2012, 06:51 AM
Revathi R Revathi R is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 18 Revathi R User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 57 sec
Reputation 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#

Reply With Quote
  #17  
Old December 27th, 2012, 07:56 AM
Revathi R Revathi R is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 18 Revathi R User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 57 sec
Reputation Power: 0
Hi

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


Regards
Revathi

Reply With Quote
  #18  
Old December 27th, 2012, 10:20 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,840 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 19 h 21 m 53 sec
Reputation Power: 1774
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.
Quote:
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
Quote:
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

Reply With Quote
  #19  
Old December 27th, 2012, 11:40 PM
Revathi R Revathi R is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 18 Revathi R User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 57 sec
Reputation 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.

Reply With Quote
  #20  
Old December 28th, 2012, 01:59 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,840 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 19 h 21 m 53 sec
Reputation Power: 1774
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.....

Reply With Quote
  #21  
Old December 28th, 2012, 03:33 AM
nrvvhjvx nrvvhjvx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 nrvvhjvx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 23 sec
Reputation 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

Reply With Quote
  #22  
Old December 28th, 2012, 03:37 AM
Revathi R Revathi R is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 18 Revathi R User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 57 sec
Reputation Power: 0
Credit goes to salem...

Thanks once again salem

Reply With Quote
  #23  
Old December 31st, 2012, 03:47 AM
Revathi R Revathi R is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 18 Revathi R User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 57 sec
Reputation 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

Reply With Quote
  #24  
Old December 31st, 2012, 07:49 AM
Revathi R Revathi R is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 18 Revathi R User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 57 sec
Reputation 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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Pass by reference in CPP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap