Not sure if this is the right section, but I've run into a weird bug here that I can't seem to get rid off. My project compiles and runs fine VC++ 2008, but now that I've switched over to C::B, I've run into several issues. First were the linker errors, but those were easy. Now, my program compiles fine, but generates a segmentation fault when it runs. It uses Bullet for physics, and the crash happens on the stepsimulation instruction. Specifically
Code: Select all
World->stepSimulation(TDeltaTime * 0.001f, 1);
Code: Select all
#0 004148B9 btDiscreteDynamicsWorld::removeCollisionObject(btCollisionObject*) () (F:/Libraries/irrlicht-1.6/include/irrAllocator.h:30)
#1 00409BEB UpdatePhysics(TDeltaTime=720, Physics=0x22ff10) (C:/Documents and Settings/Cris/Desktop/Aftermath/Aftermath/physics.cpp:60)
#2 00406B27 main() (C:/Documents and Settings/Cris/Desktop/Aftermath/Aftermath/main.cpp:143)
And then a later post in the same thread -
Well, I changed some of the compiler flags (removed all optimizations), but now the call to removeCollisionObject is pointing to IQ3Shader.h. I'm not using any quake3 maps in my game though. All models are (.obj). Could it be that I'm using a list that might be valid in MSVC, but not with MingW G++? Heres the code using the list, its right after the stepSimulation command -
Code: Select all
for(list<btRigidBody *>::Iterator Iterator = Physics->Objects.begin(); Iterator != Physics->Objects.end(); ++Iterator)
{
UpdateRender(*Iterator, Physics);
}And Physics->Objects is
Code: Select all
list<btRigidBody *> Objects; EDIT: Oh, and I know thats were it crashes because I set breakpoints in various spots and ran the debugger, and thats the line it always crashes on. I commented out the call to UpdatePhysics in main(), and it runs like gravy. The call looks like -
Code: Select all
u32 TimeStamp = timer->getTime();
DeltaTime = 0;
while(device->run() && driver)
{
DeltaTime = timer->getTime() - TimeStamp;
TimeStamp = timer->getTime();
UpdatePhysics(DeltaTime, &Physics); //(Physics) being a structure I use to hold all the data for the physics functions.Thanks =]