Bus Error?
#16
Posted 15 November 2005 - 08:12 AM
#17
Posted 15 November 2005 - 09:00 AM
add at line 9:
#include <conio.h> // getch()
add 2 lines below line 73 which is - spriteBase sunBase("data/sun");
cout << " program halted " << endl;
getch();
compile and run with the 3 new lines. is " program halted " displayed? does the 2nd file look ok, now? press any key to continue. does it crash, now? if "program halted" is not displayed, please provide details of the behavior so we can debug the file reading code.
here's what we are doing - we haven't fixed anything, yet. we have commented out a block of code which has a problem. we are trying to see if we can read the 'info' files. it appeared earlier that reading the files was causing a problem, but I suspect that is not the case. the results of the test above will tell us for sure.
EDIT
as to the counting:
if you see the following, it is expected
count = 0 for 1.bmp
count = 1 for 2.bmp
...
count = 8 for 9.bmp
Edited by bdlt, 15 November 2005 - 12:35 PM.
#18
Posted 15 November 2005 - 04:53 PM
you can ignore post #17 above 'EDIT". the file reading code is fine. the program first crashes at the line below:
itsAnimation[count].image = SDL_DisplayFormat(temp);
it still crashes with only SDL_DisplayFormat(temp);
this is not good news, since this is part of the SDL code.
the next step - compare your code to the original tutorial files and see if anything is missing.
bdlt
EDIT:
try using lesson3.cpp instead of tut3.cpp and make the following changes:
1. rename CSpriteBase.cpp to CSpriteBase2.h
2. rename CSprite.cpp to CSprite2.h
3. modify lines 16 & 17(line numbers may vary on your editor) of lesson3.cpp to:
#include "CSprite2.h"
#include "CSpriteBase2.h"
this compiled and ran using dev-c++
Edited by bdlt, 15 November 2005 - 06:06 PM.
#19
Posted 15 November 2005 - 06:04 PM
#20
Posted 15 November 2005 - 10:21 PM
try using lesson3.cpp instead of tut3.cpp and make the following changes:
1. rename CSpriteBase.cpp to CSpriteBase2.h
2. rename CSprite.cpp to CSprite2.h
3. modify lines 16 & 17(line numbers may vary on your editor) of lesson3.cpp to:
#include "CSprite2.h"
#include "CSpriteBase2.h"
this compiled and ran using dev-c++
I tried that, and using G++, it did nothing but throw errors at me about class redefinitions and such.
#21
Posted 16 November 2005 - 12:07 AM
you need 5 files CSprite.h, CSprite2.h, CSpritebase.h, CSpritebase2.h, and lesson3.cpp(with the include statements as shown in lesson3.txt).
if it doesn't work on your system with only these 5 files, we can try to debug tut3.cpp.
you may need to create a new folder and copy only these 5 files into it.
Attached Files
Similar Topics
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users