Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling C++11 on g++ 4.4.7 in Red Hat linux [closed]

I have already tried:

g++ -std=c++11 my_file.cpp -o my_prog
g++ -std=c++0x ...
g++ -std=gnu++0x ... 

and I keep getting this message:

error: unrecognized command line option
like image 607
MatanKri Avatar asked May 07 '14 16:05

MatanKri


People also ask

Does gcc 11 support C ++ 17?

C++17 features are available since GCC 5. This mode is the default in GCC 11; it can be explicitly selected with the -std=c++17 command-line flag, or -std=gnu++17 to enable GNU extensions as well.

Is G ++ and gcc the same?

“GCC” is a common shorthand term for the GNU Compiler Collection. This is both the most general name for the compiler, and the name used when the emphasis is on compiling C programs (as the abbreviation formerly stood for “GNU C Compiler”). When referring to C++ compilation, it is usual to call the compiler “G++”.

What version of gcc is RHEL8?

RHEL8 : gcc 8. X or gcc 9. X in app stream. RHEL7 : gcc 4.8.


2 Answers

C++0x/C++11 Support in GCC

From there you can see that C++11 is supported since gcc 4.7 and gcc 4.4 has C++0x support.

Quote from Status of Experimental C++0x Support in GCC 4.4:

GCC provides experimental support for the upcoming ISO C++ standard, C++0x. This support can be enabled with the -std=c++0x or -std=gnu++0x compiler options; the former disables GNU extensions.

So it should work with -std=c++0x or -std=gnu++0x.

like image 192
bolov Avatar answered Oct 03 '22 16:10

bolov


It's not clear what your problem is:

[11:51am][wlynch@apple /tmp] cat /etc/redhat-release 
CentOS release 6.5 (Final)
[11:51am][wlynch@apple /tmp] g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) 
[11:51am][wlynch@apple /tmp] g++ -std=c++0x simple.cc 
[11:51am][wlynch@apple /tmp]
like image 22
Bill Lynch Avatar answered Oct 03 '22 14:10

Bill Lynch