Im making a project for school and im stuck at this one part. Im trying to use a vector of objects that i defined. But i want the vector of objects to be declared inside a class declaration and then initialized inside the constructor of that class. Here is my code:
that is my class declaration called map.h. You can see i am declaring a vector of Waypoints which is a class i defined and included at the top of the file. Now in map.cpp where i declare my constructor i want to push Waypoint obejcts onto the vector like this:
void initMap(); // this will create the ocean floor and water top in a glList
void DrawGround(GLfloat); // the y position that the ocean floor will be drawn
/* DISPLAY LISTS */
GLuint ground; // Storage For The net_box Display List
GLUquadricObj *quadratic; // Storage for this->quadratic objects
Now if i do that everything compiles fine but when i run the program in visual studio's 2005 i get a pop up error saying
Waypoint test = Waypoint(10.0, 20.0, 6.0);
"windows has triggered a breakpoint in pathfinder.exe
This may be due to the corruption of the heap, and indicates a bug in pathfinder.exe or any of the DLLs is has loaded.
The out put window may have more diagnostic information"
I really do not get why is is giving me this error. I think it has something to do with declaring a vector of waypoints in the class definition because if i just write in int main()
that works just fine.
Waypoint obj = new Waypoint(10.0, 10.0, 2.0);
Does anyone know what im doing wrong?