# Strange ID3D10Device identifier error.

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

## Recommended Posts

First off, here's the code:
#ifndef STATICMESH_H
#define STATICMESH_H

class StaticMesh
{
public:
StaticMesh();
~StaticMesh();

void Init(char* filename, ID3D10Device* device);
void Render();
private:
ID3D10Device* device;
LPD3DXMESH mesh;
LPD3DXBUFFER materialBuffer;
DWORD numMaterials;
}

#endif


The error I get is: error C2061: syntax error : identifier 'ID3D10Device' I have another header here:
#ifndef CRATE_H
#define CRATE_H

#include "d3dUtil.h"

class Crate
{
public:
Crate();
~Crate();

void Draw();
void Init(ID3D10Device* device , float scale);
private:
DWORD numVertices;
DWORD numFaces;

ID3D10Device* d3dDevice;
ID3D10Buffer* vertexBuffer;
ID3D10Buffer* indexBuffer;
};

#endif


It uses ID3D10Device in the same manner and gets no errors. I'm not sure at all what it means.

##### Share on other sites
Read "Organizing code files in C++."

Your first header is becoming part of some translation unit (i.e., is included from a .cpp file) such that there is no declaration of ID3D10Device prior to the definition of StaticMesh. In other words, you are essentially not including the Direct3D 10 headers before you try to define the StaticMesh class. Since translation units (the sum of a single .cpp file after preprocessing) are compiled in isolation, when the compiler is compiling the .cpp file that includes that StaticMesh header, it doesn't know what ID3D10Device is.

Chances are you just need to include your D3DUtil.h header in the static mesh class, assuming that header contains what I think it contains.

##### Share on other sites
Oh god, this is why I should sleep more. Thanks. That's exactly what was happening. <d3dx10.h> is included in d3dUtil.h. I will definitely still read that article. I'm sure there's a lot more I need to learn.

Thanks again.

EDIT: Now I'm getting an even more cryptic error..

error C2146: syntax error : missing ';' before identifier 'mesh'
and
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I don't think it's a problem in my d3dUtil.h. The same header is included in many places without causing problems. Could the missing type specifier mean it can't see LPD3DXMESH?

I get the same errors referring to materialBuffer right after these.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5
frob
13

• 9
• 15
• 10
• 9
• 17
• ### Forum Statistics

• Total Topics
632602
• Total Posts
3007363

×