I'm new to programming and the topic of header files is sort of bogging me down after I started using a lot of them. In addition to that I'm trying to use precompiled headers. I'm also using the SFML library so I have those headers that also have to be included.

Right now I have stdafx.h, main.cpp, then classes A, B, C, and D contained within A.h, A.cpp, B.h, B.cpp, C.h, C.cpp, D.h, and D.cpp.

What order would I go about including the headers in all files if

* all classes contain an instance of an SFML class
* class D contains an instance of class A and class C
* class C contains an instance of class B
My code: (note: all headers have header guards)

stdafx.h:

```
#include <SFML/Graphics.hpp>
#include <iostream>

```

A.h

```
#include "stdafx.h"
class A
{
    //sfml class
};

```

A.cpp

```
#include "stdafx.h"
#include "A.h"

```

B.h

```
#include "stdafx.h"
class B
{
    //sfml class
};

```

B.cpp

```
#include "stdafx.h"
#include "B.h"

```

C.h

```
#include "B.h"
class C: public B
{

};

```

C.cpp

```
#include "stdafx.h"
#include "C.h"

```

D.h

```
#include "A.h"
#include "C.h"
class D
{
    A a;
    C C; // if left uncommented I recieve a '1 unresolved externals' error
    //sfml class
}

```

D.cpp

```
#include "stdafx.h"
#include "D.h"

```

main.cpp

```
#include "stdafx.h"
#include "D.h"

```