Hello guys. I'm involved with C++ for about 3 weeks by now. So far i enjoy the learning process. Something strange occured today tho. I copied this example from Arrays chapter and i couldn't compile it for some reason. Maybe the book i read is outdated, or my CodeBlocks IDE is messing with me. What do you think?
#include <iostream>
#include <cstdlib>
using namespace std;
I thought that my compiler is set by default for C++ 11 version, apparently not! :D
No, by default g++ defaults to -std=gnu++XX, where XX is 98 until the 6.0 version of the compiler where the default changed to -std=gnu++14. The "gnu" allows compiler specific features to be used, to disable these you need to use -std=c++XX where the XX is one of the following1 98, 11, 14, or 17. You should also use -pedantic or -pedantic-errors along with the -std=c++XX to eliminate all compiler specific hacks from being used.
1: If your version of the compiler supports those specific standards, see the documentation for your specific version to for specifics.