# Problem creating the FVF macros for the vertex structures

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

## Recommended Posts

Hi, I am trying to create a vertex structure, but I get an error saying, "'|': unexpected in macro formal parameter list" for this code: #define VERTEX_FVF( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 ) After that error, I also get errors for the 'D', then the next '|' and it continues through all of them. The only thing I can think of, is that the program doesn't know where the parameters came from. I thought they were included when linking some of the directx libs, so I found the d3d9types.h file, where they are defined, and I included that file at the top of the page, but it still had the same errors. I'm using VS.NET '03, and I'm still new to it, and how you link files to it. If anyone has experienced this before, or has any idea of what I am doing wrong, please reply. Thanks, Kevin

##### Share on other sites
You need a space between VERTEX_FVF and the paren.

It thinks you are creating a macro that takes parameters:
#define macro(x) (x + 1)

##### Share on other sites
You can use FVF like follow. Choose which is useful for you. In your example you forget space after VERTEX_FVF. ;)

#define VertexFVF (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1)
//or
const DWORD VertexFVF =(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);

lpDevice->CreateVertexBuffer( dwNumPolygonIndex*3*sizeof(CUSTOMVERTEX),
0, VertexFVF,D3DPOOL_SYSTEMMEM, &lpVertexBuffer, NULL );

##### Share on other sites
Quote:
 Original post by 3ddreamsconst DWORD VertexFVF =(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);

And then you don't need the parenthesis around the FVF terms.

##### Share on other sites
Quote:
Original post by ET3D
Quote:
 Original post by 3ddreamsconst DWORD VertexFVF =(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);

And then you don't need the parenthesis around the FVF terms.

You dont need the Patenthesis, but it makes the code look better in my opinion.

##### Share on other sites

Perhaps it is clearer to place the FVF inside the vertex class/struct
class Vertex{public:   vector pos;   vector normal;   enum{       FVF = D3DFVF_XYZ | D3DFVF_NORMAL       };};lpDevice->CreateVertexBuffer( dwNumPolygonIndex*3*sizeof(Vertex),0, Vertex::FVF,D3DPOOL_SYSTEMMEM, &lpVertexBuffer, NULL );

##### Share on other sites
lol, I always thought spaces were optional. Thanks for your help guys, that had been bugging me for weeks.