Help with "LPDIRECT3DSURFACE9 * Knight already declared in Game.obj" error message

Started by
2 comments, last by Jazonxyz 16 years, 11 months ago
Why does my compiler show: LPDIRECT3DSURFACE9 * Knight already declared in Game.obj if my compiler used to compile the same code without any problem? EDIT: "HELP" is not an appropriate subject line. [Edited by - jollyjeffers on May 4, 2007 11:20:26 AM]
Advertisement
try cleaning your build (or deleting the contents of your debug folder, it amounts to the same thing).

this somtimes clears up this error.
Most likely you define your variable it in a .h files.

In your .h file, declare that the variable exists with "extern". In ONE .cpp file, actually put the variable there. Any file that includes the .h will be able to refer to the variable.

In knight.h
extern LPDIRECT3DSURFACE9 Knight;

In knight.cpp
LPDIRECT3DSURFACE9 Knight = 0;

In any other .cpp
#include "knight.h"
...code here can see knight.cpp's Knight variable.
Quote:Original post by Jazonxyz
Why does my compiler show:

LPDIRECT3DSURFACE9 * Knight already declared in Game.obj

if my compiler used to compile the same code without any problem?

EDIT: "HELP" is not an appropriate subject line.


Error Fixed :-)

This topic is closed to new replies.

Advertisement