Reputation: 438
I just discovered the hidden gem crtdbg.h
which makes memory leak detection so much easier. Unfortunately, when I linked DirectX into my program today, I got some errors I've never seen before.
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error C2059: syntax error : 'constant'
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error C2091: function returns function
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error C2802: static member 'operator new' has no formal parameters
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(426): error C2059: syntax error : 'constant'
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(426): error C2090: function returns array
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.inl(1003): error C2761: 'void *(__cdecl *_D3DXMATRIXA16::operator new(void))(size_t)' : member function redeclaration not allowed
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.inl(1003): fatal error C1903: unable to recover from previous error(s); stopping compilation
It seems like when crtdbg overrides the new operator, it breaks something in the DirectX SDK (in case you didn't notice in the errors, I am using the DirectX 11 SDK). Is anything like this documented? A few searches didn't yield any results. I really hope I can continue to use these memory debugging tools, and any workarounds would be greatly appreciated!
Upvotes: 1
Views: 611
Reputation: 438
Ok, I figured it out. I found this post via Google. (I wish Stack Overflow had shown it to me on the sidebar when I was typing this! Or maybe it did and I missed it...).
Basically, I need to move the including of crtdbg.h
, stdlib.h
and the definition of _CRTDBG_MAP_ALLOC
to a separate header, and use the Forced Include File
option under C/C++ >> Advanced in the project properties page to force that include file everywhere. This seems to make it override all other new
overrides.
Upvotes: 1