200 LNK errors ,caused by incorrect #includes?

Hi there,basically my problem is that I'm making a DirectX program,I made all function prototypes in a header - prototype.h and the bodies in the other .cpp files,and all .cpp files include prototype.h and prototype.h includes all .cpp files,I also use
1
2
3
4
5
#ifndef _SMTH_H_
#define _SMTH_H_
....
....
#endif 

to prevent multi-includes and all,but I still get hundreds of errors like
Error	79	error LNK2005: "float camera::rotation" (?rotation@camera@@3MA) already defined in D3D.obj

and each error is like 10 times
I also used to get some "external" error,but I fixed it by using extern

I think the solution is probably something simple and stupid I overlooked,but I can't quite come up with the solution :(
Last edited on
Header files include other header files, not CPP files. CPP files can include other CPP files and of course, header files. So including all CPP files inside the header files is a big No No.
There is no real restriction how you include things but normally you never want to include .cpp files.
I know Peter, but no guidelines have guided this poor fellow into this mess, so it is really best not to mention those details at least for now, for the sake of teaching.
Topic archived. No new replies allowed.