954,487 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

compiling using g++ results to undefined reference

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

go939
Newbie Poster
6 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

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..

thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
 

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....

go939
Newbie Poster
6 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

Maybe the function isn't defined in any of your source code files?

Infarction
Posting Virtuoso
1,580 posts since May 2006
Reputation Points: 683
Solved Threads: 53
 

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.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You