|
|
|
|
g++ -ansi -Wall -Wextra -pedantic -Wmissing-declarations -Winit-self -Wold-style-cast -Woverloaded-virtual -Wuninitialized employee.cpp |
|
$ g++ -ansi -Wall -Wextra -pedantic -Wmissing-declarations -Winit-self -Wold-style-cast -Woverloaded-virtual -Wuninitialized -std=c++11 theperson01.cpp |
$ g++ -ansi -Wall -Wextra -pedantic -Wmissing-declarations -Winit-self -Wold-style-cast
-Woverloaded-virtual -Wuninitialized theperson01.cpp
theperson01.cpp: In function ‘int main()’:
theperson01.cpp:86:74: warning: extended initializer lists only available with -std=c++11 or
-std=gnu++11 [enabled by default]
employees[0] = {"Susan Meyers", 47899, "Accounting", "Vice President"};
^
theperson01.cpp:86:18: warning: extended initializer lists only available with -std=c++11 or
-std=gnu++11 [enabled by default]
employees[0] = {"Susan Meyers", 47899, "Accounting", "Vice President"};
^
theperson01.cpp:87:60: warning: extended initializer lists only available with -std=c++11 or
-std=gnu++11 [enabled by default]
employees[1] = {"Mark Jones", 39119, "IT", "Programmer"};
^
theperson01.cpp:87:18: warning: extended initializer lists only available with -std=c++11 or
-std=gnu++11 [enabled by default]
employees[1] = {"Mark Jones", 39119, "IT", "Programmer"};
^
theperson01.cpp:88:69: warning: extended initializer lists only available with -std=c++11 or
-std=gnu++11 [enabled by default]
employees[2] = {"Joy Rogers", 81774, "Manufacturing", "Engineer"};
^
theperson01.cpp:88:18: warning: extended initializer lists only available with -std=c++11 or
-std=gnu++11 [enabled by default]
employees[2] = {"Joy Rogers", 81774, "Manufacturing", "Engineer"};
^
|
$ g++ -ansi -Wall -Wextra -pedantic -Wmissing-declarations -Winit-self -Wold-style-cast -Woverloaded-virtual -Wuninitialized -std=c++11 theperson01.cpp |
$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.2-14' --with- bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable- languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program- suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib -- without-included-gettext --enable-threads=posix --with-gxx-include- dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable- clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu- unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable- browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java- home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with- jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar- dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 -- with-tune=generic --enable-checking=release --build=x86_64-linux-gnu -- host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.8.2 (Debian 4.8.2-14) |
-ansi flag), but you have C++11 code. So you might have to alter your code to comply with C++98. But your teacher should have told you all if that is the case.-std=c++11 overrides the -ansi flag. |
|
echo ..........................
echo -e '\n\nstandard c++ (-std=c++11)\n------------------------------'
echo g++ && g++-4.8 -std=c++11 -Wall -Wextra -pedantic-errors main.cpp && echo 'g++ ok'
echo -e '\nclang++' && clang++ -std=c++11 -stdlib=libc++ -Wall -Wextra -pedantic-errors main.cpp -lsupc++ && echo 'clang++ ok.'
echo -e '\nlegacy standard c++ (-std=c++98)\n------------------------------'
echo g++ && g++-4.8 -std=c++98 -Wall -Wextra -pedantic-errors main.cpp && echo 'g++ ok'
echo -e '\nclang++' && clang++ -std=c++98 -stdlib=libc++ -Wall -Wextra -pedantic-errors main.cpp -lsupc++ && echo 'clang++ ok.'
echo -e '\nnon-standard (g++/clang++ default)\n------------------------------'
echo g++ && g++-4.8 -Wall -Wextra main.cpp && echo 'g++ ok'
echo -e '\nclang++' && clang++ -stdlib=libc++ -Wall -Wextra main.cpp -lsupc++ && echo 'clang++ ok.'
..........................
standard c++ (-std=c++11)
------------------------------
g++
g++ ok
clang++
clang++ ok.
legacy standard c++ (-std=c++98)
------------------------------
g++
main.cpp: In function ‘int main()’:
main.cpp:86:74: error: extended initializer lists only available with -std=c++11 or -std=gnu++11
employees[0] = {"Susan Meyers", 47899, "Accounting", "Vice President"};
^
main.cpp:86:18: error: extended initializer lists only available with -std=c++11 or -std=gnu++11
employees[0] = {"Susan Meyers", 47899, "Accounting", "Vice President"};
^
main.cpp:87:60: error: extended initializer lists only available with -std=c++11 or -std=gnu++11
employees[1] = {"Mark Jones", 39119, "IT", "Programmer"};
^
main.cpp:87:18: error: extended initializer lists only available with -std=c++11 or -std=gnu++11
employees[1] = {"Mark Jones", 39119, "IT", "Programmer"};
^
main.cpp:88:69: error: extended initializer lists only available with -std=c++11 or -std=gnu++11
employees[2] = {"Joy Rogers", 81774, "Manufacturing", "Engineer"};
^
main.cpp:88:18: error: extended initializer lists only available with -std=c++11 or -std=gnu++11
employees[2] = {"Joy Rogers", 81774, "Manufacturing", "Engineer"};
^
clang++
main.cpp:86:20: error: expected expression
employees[0] = {"Susan Meyers", 47899, "Accounting", "Vice President"};
^
main.cpp:87:20: error: expected expression
employees[1] = {"Mark Jones", 39119, "IT", "Programmer"};
^
main.cpp:88:20: error: expected expression
employees[2] = {"Joy Rogers", 81774, "Manufacturing", "Engineer"};
^
3 errors generated.
non-standard (g++/clang++ default)
------------------------------
g++
main.cpp: In function ‘int main()’:
main.cpp:86:74: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
employees[0] = {"Susan Meyers", 47899, "Accounting", "Vice President"};
^
main.cpp:86:18: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
employees[0] = {"Susan Meyers", 47899, "Accounting", "Vice President"};
^
main.cpp:87:60: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
employees[1] = {"Mark Jones", 39119, "IT", "Programmer"};
^
main.cpp:87:18: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
employees[1] = {"Mark Jones", 39119, "IT", "Programmer"};
^
main.cpp:88:69: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
employees[2] = {"Joy Rogers", 81774, "Manufacturing", "Engineer"};
^
main.cpp:88:18: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
employees[2] = {"Joy Rogers", 81774, "Manufacturing", "Engineer"};
^
g++ ok
clang++
main.cpp:86:20: error: expected expression
employees[0] = {"Susan Meyers", 47899, "Accounting", "Vice President"};
^
main.cpp:87:20: error: expected expression
employees[1] = {"Mark Jones", 39119, "IT", "Programmer"};
^
main.cpp:88:20: error: expected expression
employees[2] = {"Joy Rogers", 81774, "Manufacturing", "Engineer"};
^
3 errors generated. |