1

I am trying to understand how some of the data structures are designed in stl. In ubuntu, I usually open the .h and .cpp files from /usr/local/include but in Darwin (kernel version 14.3.0) I am lost, google doesnt help much either, the file structure is different. So, could you please tell me where are those libraries' .h and .cpp files in mac?

P.S. I installed XCode but I didnt like it so I uninstalled it. The g++ stayed even after uninstall. Actually I never tried checking whether g++ was there before I installed Xcode. I dont have /Applications/Xcode.app so it must be someplace else.

  • Do You have Xcode installed? Here's what I have: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/ – Mateusz Szlosek Jun 17 '15 at 16:37
  • 2
    You can also check Your include paths by: gcc -x c++ -v -E /dev/null. – Mateusz Szlosek Jun 17 '15 at 16:42
1

OS X does not include c++ compilers.

You need to install Xcode and/or its command line tools to get clang (note not gcc)

The C++ standard libraries (which do not need to be actual files but are in libc++ which is the Xcode default library) The include files are in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/

  • I installed XCode but I didnt like it so I uninstalled it. The g++ stayed even after uninstall. Actually I never tried checking whether g++ was there before I installed XCode. I dont have /Applications/Xcode.app so it must be someplace else. – Shankhoneer Chakrovarty Jun 18 '15 at 1:29
  • You need the Xcode as it contains the libraries and compiles etc – user151019 Jun 18 '15 at 11:53
1

Thanks everybody. Comment by Mateusz Szlosek helped me solve the problem. The following command gives the list of directories searched for #includes:

gcc -x c++ -v -E /dev/null

and I found this directory contains all .h and .cpp files:

/Library/Developer/CommandLineTools/usr/include/c++/v1

Hope this helps somebody!

P.S. Mateusz Szlosek posted a comment and I couldnt find a way to accept a comment as an answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .