Christopher Key Guest
|
Posted: Sun Mar 07, 2004 1:54 am Post subject: Constructor Oddities |
|
|
Hello all,
I'm working a relatively simply c++ project for a university project, and
have run into a very strange problem.
My codes is dived up into a set of files for each class, or logical group of
classes I'm using, i.e.:
Cxya.h - Containing class definition, with function prototypes
Cxyz.cc - Containing the actual code relating to the class
These are all compiled to object code, then archived to libidp.a
I then have a couple of executables, which depend upon these various of
these classes. The code for these, '#include's the relevant .h files
mentioned above. They are compiled, and linked with libidp.a, and another
standard library, librobot.a, that is provided for us.
Everything was fine, until I added a constructor to one of my classes, at
which point I suddenly started getting linker errors. The code for libidp.a
compile fine, with no warnings. The problems however arise when I try to
compile and link any of the executables. It complains about 4 unsatisfied
symbols. One of which is the constructor for the class in question, the
other three relating to a class defined in librobot.a.
The strange thing about the problem is that it is sorted simply placing the
code for the problematic constructor in the classes's definition, in the
header file.
I've played with the code, and am unable to generate this problem anywhere
else, so am at a loss as to quite what is going on. I thought it may be to
do with something not being included somewhere, but I've checked all the
include statements thoroughly, with no luck.
Any advice on what may be causing this would be very much appreciated.
Many thanks,
Christopher Key
PS, I get exactly the same behaviour on different machines, using both aCC,
and g++ to do the compiling.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|