The 'easy' fix for this is to forward declare functions at the start of the program before their use and define them where required. Consider



void dothis();
string dosomething();
...
...