Problems Including <d3dx9.h> in .cu file
Spent hours on this and I think I need help, so I've condensed the problem to its shortest size possible for this post. Basically, I have three files, as shown below:


---------- main.cpp
[code]
#include <d3dx9.h>
#include "dx.h"


int main(int argc, char *argv[])
{
return 0;
}
[/code]


---------- test.cu
[code]
#include <d3dx9.h>
#include "dx.h"
[/code]


---------- dx.h
[code]
#pragma once

class TestDX {
public:
int i;
MSG msg;
};
[/code]

If I exclude the .cu file from the project, it compiles perfectly. However, with the test.cu file in, it won't compile since for some reason, CUDA won't allow me to #include <d3dx9.h>. I get the cryptic error: 1>z:\zmain\_dan\code\_libs\directx_june2010\include\d3dx9math.h(416) : error C2059: syntax error : ''

... in the "d3dx9math.h" file on this line:
typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16;

So can we find some way of getting CUDA to be friends with d3dx9.h/d3dx9math.h (perhaps by upgrading to the latest CUDA?)...?
Spent hours on this and I think I need help, so I've condensed the problem to its shortest size possible for this post. Basically, I have three files, as shown below:





---------- main.cpp



#include <d3dx9.h>

#include "dx.h"





int main(int argc, char *argv[])

{

return 0;

}






---------- test.cu



#include <d3dx9.h>

#include "dx.h"






---------- dx.h



#pragma once



class TestDX {

public:

int i;

MSG msg;

};




If I exclude the .cu file from the project, it compiles perfectly. However, with the test.cu file in, it won't compile since for some reason, CUDA won't allow me to #include <d3dx9.h>. I get the cryptic error: 1>z:\zmain\_dan\code\_libs\directx_june2010\include\d3dx9math.h(416) : error C2059: syntax error : ''



... in the "d3dx9math.h" file on this line:

typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16;



So can we find some way of getting CUDA to be friends with d3dx9.h/d3dx9math.h (perhaps by upgrading to the latest CUDA?)...?

#1
Posted 04/06/2011 02:05 AM   
Same problem with Cuda 4.0 & VC2008 - did you ever solve it?
Same problem with Cuda 4.0 & VC2008 - did you ever solve it?

#2
Posted 12/04/2011 10:14 PM   
... splitting the typedef in two is the workaround:

[code]typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16;
typedef D3DX_ALIGN16 _D3DXMATRIXA16 *LPD3DXMATRIXA16;[/code]

It seems nvcc doesn't like/understand the comma used to declare the pointer version in the same typedef.

It's not something I've ever used myself either, I didn't know you could. Would be nice if this could be fixed (note I'm still using the Feb 2010 version of DX, maybe it's changed in the current one?).
... splitting the typedef in two is the workaround:



typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16;

typedef D3DX_ALIGN16 _D3DXMATRIXA16 *LPD3DXMATRIXA16;




It seems nvcc doesn't like/understand the comma used to declare the pointer version in the same typedef.



It's not something I've ever used myself either, I didn't know you could. Would be nice if this could be fixed (note I'm still using the Feb 2010 version of DX, maybe it's changed in the current one?).

#3
Posted 12/04/2011 10:29 PM   
Scroll To Top