| re: include problem
"ScOe" <cbinders@hotmail.com> wrote in message
news:cnl61f$6v0$1@bagan.srce.hr...[color=blue]
>I have class TZone which needs to contain array of TMonster class
>
> #include "Monsters.h"
> ...
> std::vector <TMonster> Monsters;
>
> this declaration throw compiler error Undefined symbol TMonster.
> next declaration in this header is container TItems. This one compile ok.
>
> What could be the problem. I thought of cross linkage problem, but i
> couldn't find " the source of problems"
> Any suggestions ?
>
>[/color]
I'm assuming that Monsters.h declares the TMonster class? Does it? If it
declares a class called Monsters, and you want to create a vector called
TMonster that holds instances of that, then your declaration is backwards.
It would need to be:
std::vector<Monsters> TMonster;
Otherwise...
Is the TMonster class in a namespace? Do you have a Monsters.cpp
(implementation) file that goes with it? If so, does *it* compile ok? If
you have an error in that header file, then you won't be able to see
declarations from it in a dependant source file. If those ideas don't help,
then we'd need to see more code, especially the Monsters.h contents. Also
any other compiler errors or warnings, since those might point to where the
"real" problem lies.
-Howard |