Thread: Weird Error

  1. #1
    Registered User gpr1me's Avatar
    Join Date
    Mar 2006

    Weird Error - [SOLVED]

    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:

    #ifndef MAP_H
    #define MAP_H
    #include "waypoint.h"
    class Map
    	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
    	void DrawWaypoints();
    	/* DISPLAY LISTS */
    	GLuint ground;		// Storage For The net_box Display List
    	GLfloat floor_width;
    	GLUquadricObj *quadratic;	// Storage for this->quadratic objects
    	std::vector<Waypoint> way_vec;
    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:

    #include "map.h"
            Waypoint test = Waypoint(10.0, 20.0, 6.0);
    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

    "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()

            vector<Waypoint> way;
    	Waypoint obj = new Waypoint(10.0, 10.0, 2.0);
    that works just fine.

    Does anyone know what im doing wrong?
    Last edited by gpr1me; 03-19-2006 at 10:49 AM.

  2. #2
    Registered User gpr1me's Avatar
    Join Date
    Mar 2006
    nevermind, i solved the problem. It had nothing to sure with what i thought it was.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM