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

Recommended Answers

All 4 Replies

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

commented: How else will you learn to spell 'the' properly without me :) -2

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.