I'm ashamed to ask but as nobody can see my face... I just started to play with dialogblocks and wxGLCanvas but still I have
problems with the most trivial things. I've tested my opengl canvas with simple drawings (like 2D-square) and
it works. The class is defined in separate files
myglcanvas.h/c -- no problem so far.
I've written a class intCoord with some math-functions (math around
non-orthogonal coordinates and its conversion to cartesians)
myglcanvas has a private variable intCoord cell;
My problem is that actually I'm not quite sure how&where should I add
this class.
When I put in myglcanvas.h just after "////end forward declarations" an
additional line
class intCoord;
and somewhere below all myGLCanvas definitions new class with
class intCoord
{
intCoord();
~intCoord();
...
} I got "Z:....myglcanvas.h(113) : error C2079: 'myglcanvas::cell' uses
undefined class intCoord
When instead of "forward declaration" I placed there whole class
definition the code worked.
Now when I moved all the staff to intcoord.h/c, inserted both of them to
Project/Sources in DB and added to myglcanvas.h
#ifndef _INTCOORD_H_
#include "intcoord.h"
#endif
I got "Z:....intcoord.h(6) : error C2061: syntax error : identifier
"intCoord"
(6) : error C2059: syntax error : ';'
(7) : error C2449: syntax error : found '{' at
file scope (missing function header?)
and then plenty of errors in intcoord.c missing '{' before ':' (on
every function declaration)
so let's me summarize my question :
what is PROPER way to add class to DB - especially a class which is not
bounded to any wx-Element?
In message < 47092ECC.8010100%40online.de">47092ECC.8010100online.de>, tatus2 < tatus2%40online.de">tatus2online.de>
writes
>I'm ashamed to ask but as nobody can see my face... >I just started to play with dialogblocks and wxGLCanvas but still I have
>problems with the most trivial things. >I've tested my opengl canvas with simple drawings (like 2D-square) and
>it works. The class is defined in separate files
>myglcanvas.h/c -- no problem so far.
>I've written a class intCoord with some math-functions (math around
>non-orthogonal coordinates and its conversion to cartesians)
>myglcanvas has a private variable intCoord cell;
>
>My problem is that actually I'm not quite sure how&where should I add
>this class.
>
>When I put in myglcanvas.h just after "////end forward declarations" an
>additional line
>class intCoord;
>and somewhere below all myGLCanvas definitions new class with
>class intCoord
>{
>intCoord();
>~intCoord();
>...
>}
>I got "Z:....myglcanvas.h(113) : error C2079: 'myglcanvas::cell' uses
>undefined class intCoord
>
This does not seem to be a DB-specific problem - rather than a C++ one.
The above messages seems to indicate that on line 113 of myglcanvas.h
there is code that requires a _definition_ of the intCoord class. (E.g.
an instance of that class is being used as a data member. For this the
compiler would need to know, at least, the space that this member
required.) Is there a reference to such a name on that line? Your
forward _declaration_ ("class intCoord;") is not sufficient for this.
(But it would be sufficient for members that were simply pointers or
references to an intCoord.)
In the case of the code needing a definition, as you have found out, the
relevant class definition should be visible above such a use. (I.e.
defined as source lines in that file, or #included into it.) Of course
the member functions can be in a separate .cpp file. (And I almost
always do this.)
Is this clear enough, and does it make sense?
HTH
Alec
>
>When instead of "forward declaration" I placed there whole class
>definition the code worked. >
>
>Now when I moved all the staff to intcoord.h/c, inserted both of them to
>Project/Sources in DB and added to myglcanvas.h
> #ifndef _INTCOORD_H_
> #include "intcoord.h"
> #endif
>I got "Z:....intcoord.h(6) : error C2061: syntax error : identifier
>"intCoord"
> (6) : error C2059: syntax error : ';'
> (7) : error C2449: syntax error : found '{' at
>file scope (missing function header?)
>and then plenty of errors in intcoord.c missing '{' before ':' (on
>every function declaration)
>
>
>
>so let's me summarize my question :
>what is PROPER way to add class to DB - especially a class which is not
>bounded to any wx-Element?
> >thank's for help
>Kris
>
> >
>Yahoo! Groups Links
>
>
>