Jump to content
  • Advertisement
Sign in to follow this  

d3dx9math.h compile problem

This topic is 4732 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Good morning! I have a problem compiling my renderer using the d3dx9.h include files. I get several error messages:
c:\Programme\Microsoft DirectX 9.0 SDK (April 2005)\Include\d3dx9math.h(392) : error C2059: syntax error : 'string'
c:\Programme\Microsoft DirectX 9.0 SDK (April 2005)\Include\d3dx9math.h(392) : error C2091: function returns function
c:\Programme\Microsoft DirectX 9.0 SDK (April 2005)\Include\d3dx9math.h(392) : error C2802: static member 'operator new' has no formal parameters
c:\Programme\Microsoft DirectX 9.0 SDK (April 2005)\Include\d3dx9math.h(393) : error C2059: syntax error : 'string'
c:\Programme\Microsoft DirectX 9.0 SDK (April 2005)\Include\d3dx9math.h(393) : error C2090: function returns array
c:\Programme\Microsoft DirectX 9.0 SDK (April 2005)\Include\d3dx9math.inl(987) : error C2761: 'void *(__cdecl *_D3DXMATRIXA16::operator new(void))(size_t)' : member function redeclaration not allowed
I think I have this problem because of an overloaded 'new' operator (using a
#define new new(...)
), which is included in another of my headers, but I'm not so sure... Any ideas? Thanks, flix

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Morlith
#define new new(...)

That actually works? Thats crazy. How can you tell if the define is calling new or itself?

Share this post


Link to post
Share on other sites
Suspect the define. This is a very fishy way of doing anything. First of all, let's not call it operator overloading because it is certainly not. Then, recall that such preprocessor directives are expanded one on one. Certainly, the definition with the ellipsis will not work but I suppose you have something else in your actual program. But then I cannot think of anything else you could put there to make it syntactically valid.


#define new new(...)
int* p = new int;
int* p = new(...) int;

#define new f(x)
int* p = new int;
int* p = f(x) int;


Look at the two examples. Shown are two ways of defining new with your method. Then a line with a call to new as it should be done and then a call to new as the macro/defintion would get expanded. Neither of them is valid.

Greetz,

Illco

Share this post


Link to post
Share on other sites
I have overloaded the 'operator' to track memory usage. I used the following syntax, which is valid and compiles fine (although I must confess, I didn't believe it in the first place too):

inline void* __cdecl operator new( size_t size, const char* file, int line )
{
[...]
}
#define new new( __FILE__, __LINE__ )

But that still doesn't solve my problem... =)

flix

Share this post


Link to post
Share on other sites

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 );



Well, D3DX is defining it's own new operator. Can't you add a
#Define new new
line right before these few lines? Or even before and after the includes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!