compiling using g++ results to undefined reference

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

Join Date: Jun 2007
Posts: 6
Reputation: go939 is an unknown quantity at this point 
Solved Threads: 0
go939 go939 is offline Offline
Newbie Poster

compiling using g++ results to undefined reference

 
0
  #1
Jul 5th, 2007
I'm running my program in linux v. 2.6.20 and gcc v. 4.1.2...i got a problem here...when i compile my source code .cpp using gcc there's no error... but when i compile using g++ there's an error "undefined reference".
sample:

File.cpp: (.text+0xc50): Undefined reference to 'ClassB::Close'

what's the problem with this?

thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: compiling using g++ results to undefined reference

 
-1
  #2
Jul 5th, 2007
Must be something to do with the way you're using them.. parameters etc.. see which object file or .so or .a file contains teh required symbols and add that on link cmd..
Are you Agile.. ?
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 6
Reputation: go939 is an unknown quantity at this point 
Solved Threads: 0
go939 go939 is offline Offline
Newbie Poster

Re: compiling using g++ results to undefined reference

 
0
  #3
Jul 6th, 2007
i already check my source code and all the include files were linked together...the only problem was that the Classes of B were undefined reference to my main source code....
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,580
Reputation: Infarction has a spectacular aura about Infarction has a spectacular aura about Infarction has a spectacular aura about 
Solved Threads: 52
Infarction's Avatar
Infarction Infarction is offline Offline
Battle Programmer

Re: compiling using g++ results to undefined reference

 
0
  #4
Jul 7th, 2007
Maybe the function isn't defined in any of your source code files?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: compiling using g++ results to undefined reference

 
0
  #5
Jul 7th, 2007
Post your code.

If that isn't practical, create a small test case which shows the same symptoms, and post that.

Post the actual command lines you used to compile your code, and actual error message(s) you get in response.
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



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC