So i have one of the wierdest bug i've seen in my life. I've bought a DirectX 11 book which comes with some [sample code]:http://www.d3dcoder.net/d3d11.htm I am pretty sure at some point in time i managed to compile and run every single sample app, but now, i have a "Access violation writing location 0xCCCCCCCC" error at runtime.
Now, this is happening one the following line :
ShadowsApp::ShadowsApp(HINSTANCE hInstance) : D3DApp(hInstance)
{
mMainWndCaption = L"Shadows Demo"; <- Crashes here !!!
mLastMousePos.x = 0;
mLastMousePos.y = 0;
...
}
mMainWndCaption being declared like this in the .h
std::wstring mMainWndCaption;
and set with a default value in the constructor of the class ShadowsApp inherits from
D3DApp::D3DApp(HINSTANCE hInstance) :
mhAppInst(hInstance),
mMainWndCaption(L"D3D11 Application"),...
I think, this is already quite odd ... Now the strangest part comes when i declare ANY variable of ANY type in the d3dApp.h, I no longer have the "Access violation writing location 0xCCCCCCCC" error, everything builds and run perfectly. As a C# programmer, this makes absolutely no sense to me. How can the declaration of a random variable in a class can "fix" such a thing ?!
Any suggestion would be greatly appreciated :-)
mMainWndCaption
's internal pointer. – Loy