The probable problem is that the first compiler wants using namespace std;before allowing the use of undecorated identifiers from this namespace (for example for_each), and the second one is excessively permissive and does not require it.
, , , , , std::for_each (using std::for_each;) (using namespace std;) - () , , - ;-).