DrylandEcology / STEPWAT2

folder
4 stars 5 forks source link

Fix #include statements requiring specific order #433

Closed chaukap closed 4 years ago

chaukap commented 4 years ago

Currently the header files must be included in a specific order, otherwise the program crashes. This is caused by the following dependencies:

And the following #include statements in File C:

#include "B"
#include "A"

Where A and B do not include each other. If the order were reversed in file C:

#include "A"
#include "B"

The compilation would fail because the compiler must read file B before file A.

Solution

We need to move all include statements to where they are first needed. In the example above this means including file B in file A, then only including file A in file C.