Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

C++11 standard library on OSX

velvia
Beginner
456 Views

Hi,

As far as I understand, Intel C++ compilers don't come with their own library and use the system library. OSX comes with libc++ from the clang project and a very old version of the GNU libstdc++, so old that std::array is still in tr1. Unfortunately, libc++ does not provide (as far as I know) any way of bound  checking the [] operator on std::vector and std::array (I don't want to use .at as I want bound checking on only when I debug my code).

 

I have compiled gcc 4.9 on my machine that comes with a new version of libstdc++. Is there any way o using this library with the Intel compiler ?

Best regards,

Francois

0 Kudos
5 Replies
Judith_W_Intel
Employee
456 Views

 

Try this option:

-gxx-name=<name>
          name and location of g++ if not where expected

This should find the right headers and right libraries based upon the location of the g++ binary.
 

Judy

 

0 Kudos
TimP
Honored Contributor III
456 Views

Judging by my experience on linux, you would need icpc 15.0 to work with g++ 4.9 or 4.10.  It should be sufficient to have that g++ set up in the environment before starting icpc, if your g++ is working in the same build environment as icpc.

0 Kudos
Andrey_B_Intel2
Employee
456 Views

Francois,

Please note that icc / icpc officially supports only libraries supported by Apple -- that is, libc++ and old libstdc++. Moreover, -gxx-name option (that, as Judy explained, lets you use some other version of libc++) will be removed from 16.0 compiler. This is a delibrate choice from our part -- to avoid potential problems and confusion with use of 3rd party C++ standard libraries that we haven't tested before releasing the compiler.

Andrey
 

0 Kudos
Andrey_B_Intel2
Employee
456 Views

Small correction from my previous message: -gxx-name option will be removed starting from 15.0 OS X compiler (to be released this year).

Andrey

0 Kudos
velvia
Beginner
456 Views

Hi Andrey,

Thanks for the information. I guess that sadly, OSX won't be my platform for development. I still can't beleive why Clang people don't put an option to bound-check the [] operator for std::vector and std::array. Coming from the Fortran world where turning on/off bound checking is as simple as a compiler switch it seems to me that some C++ people miss the pain of C-arrays and unsecure pointer arithmetic. I'll try to go to Clang forums to ask for a change.

 

best regards,

Francois

 

PS : both GNU libstdc++ and Microsoft implementation allow to turn on bound checking. Libc++ is the only STL implementation that does not come with it.

0 Kudos
Reply