我刚刚发现了隐藏的gem crtdbg.h,它使内存泄漏检测变得更容易。不幸的是,当我今天将DirectX链接到我的程序中时,我得到了一些以前从未见过的错误。
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似乎当DirectX覆盖了新的操作符时,它破坏了crtdbg SDK中的一些东西(如果你没有注意到错误,我正在使用crtdbg 11sdk)。是否有类似于此的文档?一些搜索没有得到任何结果。我真的希望我能继续使用这些内存调试工具,任何解决办法都会非常感谢!
发布于 2012-06-11 03:22:30
好了,我想通了。我找到了this post via Google. (我希望Stack Overflow在我输入这段代码的时候在侧边栏上显示了它!)也许它确实发生了,但我错过了……)。
基本上,我需要将crtdbg.h、stdlib.h的包含和_CRTDBG_MAP_ALLOC的定义移动到一个单独的头中,并使用项目属性页中C/C++ >>高级下的Forced Include File选项强制到处都包含文件。这似乎使它覆盖了所有其他new覆盖。
https://stackoverflow.com/questions/10969502
复制相似问题