#ifndef T3PointGroup
#define T3PointGroup
#include <vector>
#include "T3Coord.h"
using namespace std;
class T3PointGroup {
int point_amount;
public:
void doSomething();
vector<T3Coord*> coords;
};
#endif
C++ problem (why does it assume my class is an union?)
hi, i just can't understand this one. I created a class like any other classes i've ever created - but at compile time i get "Error: an anonymous union cannot have function members"
However i never used the Union keyword but only the Class keyword!
here's the header of my class... any idea what's the problem?? (T3 is the prefix i use to all classes in my 3D engine so don't wonder what it is)
And i also get another error i don't get.... anyone knows what "*** malloc_zone_malloc[1447]: argument too large: 4286463584" means when adding something to a vector?
thanks
What happens when you take out the vector and remove T3Coord.h inclusion.
Only the error might actually lie in there.
Oh and don't do:
using namespace std;
It's lazy and inexplicit.
ace
Only the error might actually lie in there.
Oh and don't do:
using namespace std;
It's lazy and inexplicit.
ace
> What happens when you take out the vector and remove T3Coord.h inclusion.
Nothing - just does the same
Nothing - just does the same
Quote:Original post by Anonymous Poster
you:
#ifndef T3PointGroup
#define T3PointGroup
and then
class T3PointGroup
Arrr your right i feel incredibly stupid now
thanks
Quote:Original post by Anonymous Poster
you:
#ifndef T3PointGroup
#define T3PointGroup
and then
class T3PointGroup
He has,
Is the file a .CPP file and not a .C file?
Quote:Original post by Anonymous Poster
you:
#ifndef T3PointGroup
#define T3PointGroup
and then
class T3PointGroup
AP is right:
you are #defining an empty symbol (#define T3PointGroup), so when the preprocessor encounters "class T3PointGroup { etc.." it replace T3PointGroup with T3PointGroup #definition, which is actually empty.
Fix your conditional inclusion so that it doesn't match any class name.
Presumably, he also needs to get a new compiler. One that doesn't think that a "class { int foo (); }" is a union.
i'm using GCC - the behaviour is strange. the error was actually pretty easy to spot but the error message was weird.
Another thing:
i declare 2 vectors one after the other - the second is not gonna work when adding things to it (with error: "*** malloc_zone_malloc[1447]: argument too large: 4286463584") . Look at this:
The weird thing is, if i declare them like this:
vector<T3PointGr*> tex_areas;
vector<T2Button*> poses_buttons;
poses_buttons is not going to work and the other will work fine. However if i declare them like this:
vector<T2Button*> poses_buttons;
vector<T3PointGr*> tex_areas;
tex_areas is not going to work while the other works fine.
Why does the order in which i declare the vectors make them behave weirdly??
Another thing:
i declare 2 vectors one after the other - the second is not gonna work when adding things to it (with error: "*** malloc_zone_malloc[1447]: argument too large: 4286463584") . Look at this:
The weird thing is, if i declare them like this:
vector<T3PointGr*> tex_areas;
vector<T2Button*> poses_buttons;
poses_buttons is not going to work and the other will work fine. However if i declare them like this:
vector<T2Button*> poses_buttons;
vector<T3PointGr*> tex_areas;
tex_areas is not going to work while the other works fine.
Why does the order in which i declare the vectors make them behave weirdly??
Quote:Original post by ace_lovegroveQuote:Original post by Anonymous Poster
you:
#ifndef T3PointGroup
#define T3PointGroup
and then
class T3PointGroup
He has,
Is the file a .CPP file and not a .C file?
Why would that matter?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement