Unresolved external Symbol

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 3
Reputation: pad510 is an unknown quantity at this point 
Solved Threads: 0
pad510 pad510 is offline Offline
Newbie Poster

Unresolved external Symbol

 
0
  #1
Mar 28th, 2008
Hi,

When I am trying to return a QString from a method I am getting linker error.
My code is like:

extern "C"{
_declspec QString _stdcall function1(char* name);

}

I am using MSVC 6.0 compiler.
Could any body help me?

(NOte: If I remove _stdcall its working fine)

Thanks in Advance,
pad510
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,408
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Unresolved external Symbol

 
0
  #2
Mar 28th, 2008
>>(NOte: If I remove _stdcall its working fine)
Then what's the problem? Leave _stdcall out then.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 3
Reputation: pad510 is an unknown quantity at this point 
Solved Threads: 0
pad510 pad510 is offline Offline
Newbie Poster

Re: Unresolved external Symbol

 
0
  #3
Mar 28th, 2008
Hi,

I am wondering what is the problem with _stdcall,since its working for all other types(pre defined and user defined) except QString
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,408
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Unresolved external Symbol

 
0
  #4
Mar 28th, 2008
_stdcall and _cdecl are identical and are the default for C and C++ functions. Therefore is never a reason to use _stdcall or _cdecl in C and C++ programs. Using Microsoft compilers that is. What compiler are you using?

I don't know why its not working for you. Are you sure you have the correct prototype? Do you have the source code for the function so that you can verify -- but you probably already did that.
Last edited by Ancient Dragon; Mar 28th, 2008 at 6:47 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 3
Reputation: pad510 is an unknown quantity at this point 
Solved Threads: 0
pad510 pad510 is offline Offline
Newbie Poster

Re: Unresolved external Symbol

 
0
  #5
Mar 28th, 2008
Hi,
Thanks for reply.
I am using MSVC 6.0.
Me to not sure about the problem


Thanks,
pad510
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 147
Reputation: Laiq Ahmed will become famous soon enough Laiq Ahmed will become famous soon enough 
Solved Threads: 20
Laiq Ahmed Laiq Ahmed is offline Offline
Junior Poster

Re: Unresolved external Symbol

 
1
  #6
Mar 28th, 2008
_cdecl and _stdcall has some difference, I think you are calling the function from the library written using different calling convention than the one you are using. Its basically a name decoration issue, not resolved by linkers.

In VC++ 6.0 _cdecl is the default calling convention.

_cdecl In this type convention the caller is responsible for cleaning up the stack.
_stdcall In this type of convention the callee is responsible for cleaning up the stack.

search calling conventions.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,408
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Unresolved external Symbol

 
0
  #7
Mar 28th, 2008
Originally Posted by Laiq Ahmed View Post
_cdecl and _stdcall has some difference,.
Yes you are right. .
Last edited by Ancient Dragon; Mar 28th, 2008 at 10:33 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC