January 8th, 2002, 08:37 PM #1
eh, help, please (c++)
I realize that no one needs my life story, so let's cut to the chase. I'm trying my first stab at OOP with a string class called "oostring". It's provided with my programming book (available online at: http://www.studio-ide.com/downloads/cppfiles.zip with some other stuff, if anyone cares).
Anyway, when I try to compile a simple program that only instanciates and "cout's" an oostring, project builder spits out the error "undefined symbols". Now, I'm thinking that somehow the text encoding got messed up with the source files... the compiler says that the "undefined symbols" are:
I can't find anything close to this in the oostring.h or oostring.c files ('8' does not appear in my source code anywhere). I think I might know the problem (something with stray characters or something... i dunno... but this class works fine on a PC at school...), but short of retyping the entire source code, I don't see how I could fix it.
Can anyone help me out, please?
January 10th, 2002, 11:56 AM #2
The symbol errors are generated by the linker, not the compiler. The compiler had to translate the names into unique names (the linker doesn't actually undestand the idea of overloaded functions). This is usually caused by 1 of 2 things. Either a) you are not linking in the library or object file which contains the oostring class, or b) you used cc for compiling some files and c++ for compiling others, but didn't put extern "C" around the correct include files. If you are using a Makefile, please post it and I will take a look.
January 10th, 2002, 02:51 PM #3
Hey, thanks for the response! I was looking around apple's developer site last night and came accross the fact that it was a linker error, not a compiling error, but I had no idea how to fix it. Your description got me squared away-- turns out that I just needed to add the source files "oostring.h" and "oostring.c" to the source folder in my project... got everything squared away now (boy do I feel stupid ).