icpc C ++ 11与gcc stdlib [英] icpc C++11 with gcc stdlib

查看:280
本文介绍了icpc C ++ 11与gcc stdlib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用icpc(非可选),我编译与-std = c ++ 0x所以我可以使用lambas。



但是,当我这样做时,它使用gcc stdlib创建havok,并支持另一个不支持的功能。



我已尝试定义

  __ GXX_EXPERIMENTAL_CXX0X__ 

但这没有帮助。



所以,我想要的是能够使用c ++ 0x

$ c





gcc 4.6

b
$ b

编辑错误示例:

  / usr / include / c ++ / 4.6.2 / type_traits(74):error:identifierconstexpr未定义
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:memberstd :: integral_constant< _Tp,__v> :: _ Tp不是类型name
typedef _Tp value_type;
^

/usr/include/c++/4.6.2/type_traits(76):error:memberstd :: integr_constant< _Tp,__v> :: _ Tp不是类型name
typedef integral_constant< _Tp,__v>类型;
^

/usr/include/c++/4.6.2/type_traits(77):错误:标识符constexpr未定义
constexpr operator value_type(){return value; }
^

/usr/include/c++/4.6.2/type_traits(87):error:identifierconstexpr未定义
constexpr _Tp integral_constant< _Tp,__v> ::值;


解决方案

错误显然指向C ++ 11代码,所以它听起来像你想要防止编译器看到任何,例如与 -U__GXX_EXPERIMENTAL_CXX0X __ (等效的GCC选项)。 p>

但是,如果ICC在 -std = c ++ 0x 下为您定义,您应该使用的库的版本(或在您的本地ICC安装中查找库)。很难确定C ++ 03库足以编译C ++ 11代码。


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;

解决方案

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.

这篇关于icpc C ++ 11与gcc stdlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆