Original Post
ive been trying to use the debug functionality below with directx, but am having trouble trying to get it working with "d3dx9math.h", one of the matrix types which im not even using, wont work with it. I get the following errors this is the matrix type thats causing the problem
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#include <stdlib.h>
#define DEBUG_NEW new(_CLIENT_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
#if defined(DEBUG) | defined(_DEBUG)
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
Error 2 error C2059: syntax error : 'constant' c:\program files\microsoft directx sdk (august 2008)\include\d3dx9math.h 392 ParticleEngine
Error 3 error C2091: function returns function c:\program files\microsoft directx sdk (august 2008)\include\d3dx9math.h 392 ParticleEngine
Error 4 error C2802: static member 'operator new' has no formal parameters c:\program files\microsoft directx sdk (august 2008)\include\d3dx9math.h 392 ParticleEngine
Error 5 error C2059: syntax error : 'constant' c:\program files\microsoft directx sdk (august 2008)\include\d3dx9math.h 393 ParticleEngine
Error 6 error C2090: function returns array c:\program files\microsoft directx sdk (august 2008)\include\d3dx9math.h 393 ParticleEngine
Error 7 error C2761: 'void *(__cdecl *_D3DXMATRIXA16::operator new(void))(size_t)' : member function redeclaration not allowed c:\program files\microsoft directx sdk (august 2008)\include\d3dx9math.inl 990 ParticleEngine
Error 8 fatal error C1903: unable to recover from previous error(s); stopping compilation c:\program files\microsoft directx sdk (august 2008)\include\d3dx9math.inl 990 ParticleEngine
//---------------------------------------------------------------------------
// Aligned Matrices
//
// This class helps keep matrices 16-byte aligned as preferred by P4 cpus.
// It aligns matrices on the stack and on the heap or in global scope.
// It does this using __declspec(align(16)) which works on VC7 and on VC 6
// with the processor pack. Unfortunately there is no way to detect the
// latter so this is turned on only on VC7. On other compilers this is the
// the same as D3DXMATRIX.
//
// Using this class on a compiler that does not actually do the alignment
// can be dangerous since it will not expose bugs that ignore alignment.
// E.g if an object of this class in inside a struct or class, and some code
// memcopys data in it assuming tight packing. This could break on a compiler
// that eventually start aligning the matrix.
//---------------------------------------------------------------------------
#ifdef __cplusplus
typedef struct _D3DXMATRIXA16 : public D3DXMATRIX
{
_D3DXMATRIXA16() {}
_D3DXMATRIXA16( CONST FLOAT * );
_D3DXMATRIXA16( CONST D3DMATRIX& );
_D3DXMATRIXA16( CONST D3DXFLOAT16 * );
_D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14,
FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24,
FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34,
FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 );
// new operators
void* operator new ( size_t );
void* operator new[] ( size_t );
// delete operators
void operator delete ( void* ); // These are NOT virtual; Do not
void operator delete[] ( void* ); // cast to D3DXMATRIX and delete.
// assignment operators
_D3DXMATRIXA16& operator = ( CONST D3DXMATRIX& );
} _D3DXMATRIXA16;
#else //!__cplusplus
typedef D3DXMATRIX _D3DXMATRIXA16;
#endif //!__cplusplus
#if _MSC_VER >= 1300 // VC7
#define D3DX_ALIGN16 __declspec(align(16))
#else
#define D3DX_ALIGN16 // Earlier compiler may not understand this, do nothing.
#endif
typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16;