I was running into run time errors, and stripped down my code to isolate the problem. From that I was able to write this little piece of code to demonstrate my issue:

#include <windows.h>

class test
	int a;
	void run();

	a = 5;
void test::run()
	a = 6; // comment this to prevent the runtime error.


int WINAPI WinMain(	HINSTANCE	hInstance,			// Instance
					HINSTANCE	hPrevInstance,		// Previous Instance
					LPSTR		lpCmdLine,			// Command Line Parameters
					int			nCmdShow)			// Window Show State
	test* t;


This gives me an unhandled exception in visual studio c++ 2005. I don't understand what's bad about it. Making anything static is not an option and neither is a declaring the "a" variable in the cpp file (in my version, all of this is split up properly between header and cpp).

Any insight on how to better handle this would be greatly appreciated!

Edited 7 Years Ago by dalcocer: n/a

This question has already been answered. Start a new discussion instead.