111111
111111

Reputation: 16148

icpc C++11 with gcc stdlib

I am using icpc (non optional) and I am compiling with -std=c++0x so I can use lambas.

However when I do so it creates havok with gcc stdlib with features that one supports that the other doesn't.

I have tried defining

__GXX_EXPERIMENTAL_CXX0X__

but that didn't help.

So ideally what I am asking for is the ability to use the c++0x language features with the C++03 stdlib.

gcc 4.6

icc 12.1]

EDIT example of error:

/usr/include/c++/4.6.2/type_traits(74): error: identifier "constexpr" is undefined
    static constexpr _Tp                  value = __v;
           ^

/usr/include/c++/4.6.2/type_traits(74): error: expected a ";"
        static constexpr _Tp                  value = __v;
                                          ^

/usr/include/c++/4.6.2/type_traits(75): error: member "std::integral_constant<_Tp,      __v>::_Tp" is not a type name
    typedef _Tp                           value_type;
            ^

/usr/include/c++/4.6.2/type_traits(76): error: member "std::integral_constant<_Tp,     __v>::_Tp" is not a type name
        typedef integral_constant<_Tp, __v>   type;
                              ^

 /usr/include/c++/4.6.2/type_traits(77): error: identifier "constexpr" is undefined  
         constexpr operator value_type() { return value; }
         ^

 /usr/include/c++/4.6.2/type_traits(87): error: identifier "constexpr" is undefined
      constexpr _Tp integral_constant<_Tp, __v>::value;

Upvotes: 3

Views: 3757

Answers (2)

Potatoswatter
Potatoswatter

Reputation: 137810

The errors obviously point to C++11 code, so it sounds like you want to prevent the compiler from seeing any of that, such as with -U__GXX_EXPERIMENTAL_CXX0X__ (the equivalent GCC option).

However, if ICC is defining this for you under -std=c++0x, then you should find out what version of the library you are supposed to use (or look for a library in your local ICC installation). It's far from certain that the C++03 library is sufficient to compile C++11 code.

Upvotes: 2

mikithskegg
mikithskegg

Reputation: 816

icpc only warns at such situation. Do not put attention on this. Everything will be compiled.

Upvotes: 0

Related Questions