Why do `gcc -v` and `whereis gcc` output different paths? - c++

I get the following output when I run respectively gcc -v and whereis gcc:
Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
gcc: /usr/bin/gcc
Does this mean I have multiple installations of gcc on my mac ? If so, how do I uninstall the 'extra/unnecessary' ones ?
Thanks

Related

MSYS2 Clang can't find standard headers

I've installed msys/clang using pacman and run it (from the usr/bin bash terminal) on a simple file which only includes iostream:
$ clang++ main.cpp -o prog.exe
main.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^~~~~~~~~~
1 error generated.
When I compile with mingw64/clang using the MinG64 terminal, it works. When should the msys/clang be used in such a case, then, and is there a way of making it work?
mingw64/clang --version:
$ clang --version
clang version 11.0.0 (https://github.com/msys2/MINGW-packages f5d4dab9b9db65e8b4eff740629c411ea5e21091)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:\MSYS2\mingw64\bin
usr/bin/clang --version:
$ clang --version
clang version 11.0.0 (https://github.com/msys2/MSYS2-packages dab5c29f1c61a173e404f1fd78f0c6f56441aa9f)
Target: x86_64-pc-windows-msys
Thread model: posix
InstalledDir: /usr/bin

Mac gcc/g++/clang++ compilers for programming in c++

I have a programming class that has a requirement for making the code successfully compile on gcc/g++ 4.8.x or clang++. I'm running mac OSX el capitan at the moment.
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --
with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
This is the clang++ output:
$ clang++ --version
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Would this suffice for the requirements for my class? If not how would I go about updating them?
Thank you!

i want to use g++ but my mac uses clang

I want to compile my program which uses OpenMp on mac os Sierra. I have Xcode8. I do it via terminal: g++ -fopenmp -o train train.cpp. The next errors occur:
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
Tell me please how can I solve this problem.
clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
g++ --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

How to get the gcc version of .so file on OSX 10.11.6

On mac, Enter "gcc -v" in Terminal to get the gcc version as below.
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
How to get the gcc version used to generate the .so file? For example, I want to get the gcc version from a .so file on Mac.

Not able to use C++14 features( bind,lambdas,etc and getting C++11extension warning) after installing gcc49?

It shows that gcc49 is active:
$ port select --list gcc
Available versions for gcc:
mp-gcc49 (active)
none
but version is still 4.2.1,
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
How do i fix this?