I am using OS 10.9 on mac machine. I want to know the version of gcc I am using. So I tried gcc --version
on terminal and it results :
$ gcc --version Configured with: --prefix=/Applications/Xcode5-DP.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode5-DP.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.1.58) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix
Here in output, there is no detail related to gcc but clang is there. I am confused whether gcc command executes clang or gcc(gnu).
The name of the C compiler (that was installed along with the command line tools) is gcc. To check that this is now successfully installed, enter "gcc --version" at the prompt.
The gcc application will be installed by default in /usr/local/bin. Personally, I use Apple's clang/clang++ compilation tools rather than deal with GNU gcc. These instructions will give you a C compiler environment.
gcc --version will tell you the version of the gcc executable in your path. rpm -q libstdc++-devel will tell you the version of the package that owns the C++ standard library headers. rpm --verify libstdc++-devel will check that you haven't messed up the C++ headers by replacing them with something else.
You seem to not actually have gcc on your path. As of recent versions of Xcode, it installs a "gcc" that is instead a link to Clang.
gcc -dumpversion | cut -f1 -d.
-dumpversion
Print the compiler version (for example,3.0
) — and don't do anything else.
The same works for following compilers/aliases:
cc -dumpversion g++ -dumpversion clang -dumpversion tcc -dumpversion
Be careful with automate parsing the GCC output:
--version
might be localized (e.g. to Russian, Chinese, etc.)--version
output will contain something like Android (5220042 based on r346389c) clang version 8.0.7
(it's real version string)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With