Originally Posted by
Elysia
So instead of guessing, can you track where it crashes in the debugger and why?
Not all debuggers initializes variables to 0. Microsoft's debugger throws an exception if an uninitialized variable is used.
No, I can't. It doesn't crash in the debugger in either debug or release and everything appears to be normal which is what is making this so frustrating and why I've posted on cprogramming.com... It only crashes when I run the program outside the debugger which isn't exactly helpful.
Sp I've resorted to using messages to let me know exactly when the program stops working. Turns out that it crashes as soon as I try to access member classes of a super class -- class Game.
The member classes are defined within Game as such:
Code:
Filesystem *mFilesystem; /**< File system functions and services. */
Configuration *mConfiguration; /**< Configuration parser. */
StateManager *mStateManager; /**< State manager */
Renderer *mRenderer; /**< Renderer. Initialized on startup. */
Mixer *mMixer; /**< Mixer. Initialized on startup. */
Gui *mGui; /**< GUI System and Manager. */
Lua *mLua; /**< Lua Script Interpreter. */
These are all initialized in Game's Constructor:
Code:
Game::Game(const char *configFile, const char *argv_0)
{
Logger::logFile << "Initializing subsystems..." << endl;
mFilesystem = new Filesystem(argv_0);
mConfiguration = new Configuration(configFile, mFilesystem);
mRenderer = new SDL_Renderer(mConfiguration);
mMixer = new SDL_Mixer(mConfiguration);
mStateManager = new StateManager(mFilesystem, mRenderer, mMixer);
mLua = new Lua(mFilesystem);
mGui = new Gui(mRenderer, mFilesystem);
Logger::logFile << "Subsystems initialized..." << endl;
Logger::logFile << "===================================\n" << endl;
}
This appears to succeed as the Logger functions work as expected and show up in the log file.
Game has a function defined, ::go() which is basically a giant loop. Once I get into that function I have a line like this:
Code:
Logger::logFile << mConfiguration->getGraphicsHeight();
All of the above classes have similar access functions return various values...
-----
As I've been writing this out I discovered that mGui has bad values in it. I thought "Maybe if I comment it..." and lo and behold it works.
Thanks again everybody for your help. Without this forum and your replies I'd probably still be banging my head on the desk.... so thank you!