redefinition error with all the include directives!

Hi.
Im trying to run a program in mfc but it keep making errors that are all related to header files
I have 2 question:
1. When i define some utility class how should i use them in my view.cpp and view.h and doc.cpp and doc.h
Should i just include each i needed there?
I made a header.h files and there,i included all the headers i had definded.
Is it right?
2.when the redefinition error occur what point should i notice? To solve it.
Thanks.
i dunno what you meant by mfc?
Anyway:
1) hmm.you can do that, but, it would be great if you use them with their own cpps for small projects, unless your doing libraries or your programs got too long.
2)redefinition? I dont know which part you are redefining,but I can see 2 cases, maybe a)your doing a global variable
if so use extern see:http://www.cplusplus.com/forum/general/1143/
b)you forgot the #ifdef #ifndef stuffs
Hope it helps. :)
im sorry for not being clear before..
from mfc ,, i mean visual studio, mfc application..
i wanted to make Tetris
so i had CTetrisView class and CTetrisDoc class...
and from utility class and all the header files i mean the Figure class,ColorGrid class Square class etc (owned-defined)
finally i have these files:
CTetrisView.h
CTetrisView.cpp
CTetrisDoc.h
CTetrisDoc.cpp
these are made by wizard and i just add some and override some to them..
and then :
Figure.h
Figure.cpp
ColorGrid.h
ColorGrid.cpp
Square.h
SquareInfo.cpp

i need the latter classes to use in CTetrisDoc.cpp and also need them to use in themselve(i hope it be clear!)
for example i need the defined stuff in SquareInfo.cpp in CTetrisDoc.h
well
i made a header file and included all the '.h' files on it.
then included that(headers.h) in CTetrisDoc.h and in CTetrisDoc.cpp i had already included CTetrisDoc.h...so the headers.h was included there:(((
now i have lots of error..
and just confused:((
plz just give me an article about these stuff...to clarify "where should i include what!!!"(this is my main question):)
and a simple explanation of helping #ifndef and #ifdef .
i cant get that.
thank you for your time.
hmm..you could try here http://www.learncpp.com/cpp-tutorial/110-a-first-look-at-the-preprocessor/

It would be great if you just start small ones(lesser header files, maybe 1 to 3) first so that you can get the feel on how they work, and come back to that project when your feeling comfortable with them. :)

> to clarify "where should i include what
http://www.cplusplus.com/forum/articles/10627/ (you are interested in point 4, but read the whole article)
Topic archived. No new replies allowed.