-Werror might be causing trouble for you. Since it would report all warning as an error, you compilation would fail even if it had just warning. Where as, in OnlineGDB it would be treated as just warning and compilation go ahead.