Jump to content
  • Advertisement
Sign in to follow this  

Strange ID3D10Device identifier error.

This topic is 3349 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

First off, here's the code:

class StaticMesh

	void Init(char* filename, ID3D10Device* device);
	void Render();
	ID3D10Device* device;
	LPD3DXBUFFER materialBuffer;
	DWORD numMaterials;


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

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

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


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

Share this post

Link to post
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 this post

Link to post
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'
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.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!