Your solution works because at the bottom of ofMain.h you find this line:

using namespace std;

Instead of including the whole ofMain.h you could add that single line, otherwise compilation will be slower.

The recommended approach starting from OF 0.10 is to prefix std:: when using vector and string and others to avoid name collisions. This will be slowly applied to all maintained addons, but it’s good to know how to fix it yourself