assertion errors
-
I am trying to push a variable of type bobject into a vector, i get an assertion error when i try to push it. Does anybody know what the problem could be?
Show your code, especially how you declared your vector (be sure to check the 'Ignore HTML tags in the message' checkbox located below the posting edit box on the CP posting page), the line where you call push_back (or push_front) and then it might help if you also posted the lines that generated the actual assertion (will contaion the text ASSERT or VERIFY or some variation there of) that your debugger will jump to when you tell it to debug your program after the assertion happens.
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
Show your code, especially how you declared your vector (be sure to check the 'Ignore HTML tags in the message' checkbox located below the posting edit box on the CP posting page), the line where you call push_back (or push_front) and then it might help if you also posted the lines that generated the actual assertion (will contaion the text ASSERT or VERIFY or some variation there of) that your debugger will jump to when you tell it to debug your program after the assertion happens.
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
The code which pushes the vector bobject o=read_Obj(argv[i]); o.active=1; //Active o.picked=0;//Not picked o.path=argv[i]; //save object path ---------------->store_normal(o); glLoadIdentity (); glGetFloatv(GL_MODELVIEW_MATRIX,o.m); //initialize all variables cout<<"in"<ob.MyObjects.push_back(o); the store_normal code is void store_normal(bobject o) { for(int i =0;i
-
The code which pushes the vector bobject o=read_Obj(argv[i]); o.active=1; //Active o.picked=0;//Not picked o.path=argv[i]; //save object path ---------------->store_normal(o); glLoadIdentity (); glGetFloatv(GL_MODELVIEW_MATRIX,o.m); //initialize all variables cout<<"in"<ob.MyObjects.push_back(o); the store_normal code is void store_normal(bobject o) { for(int i =0;i
You have still not supplied the crucial piece of information, what is the exact assertion? Just saying "an assertion happened" means nothing, it could be anything. Learn to use the tools you have in front of you. Start the debugger, step through and into your code. Watch the values of all your variables, and when you hit an assertion look at the code and all the variables referenced in that code. At least one of the variables will have an invalid value. Figure out which one it is, and then use the call stack to backtrace to where that invalid value was set. It can take a little bit of detective work, but you can do it. I can't do it with the information you have supplied so far. Good Luck!:)
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!