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

icpc 12.1.0, Ubuntu 11.10 (oneiric) and g++

YannGolanski
Beginner
724 Views
DISCLAIMER: I know that Ubuntu 11.10 (oneiric) is not supported thus why I am not asking officially. However, if anyone had a solution, that would be nice to know.

I am getting the following errors on a simple c++ programme and was wondering if anyone knew of a solution:

$ make

icpc -ansi -O2 -w1 -std=c++0x -I/usr/include/boost -c -o YYY.o YYY.cc

/usr/include/c++/4.6.1/type_traits(74): error: identifier "constexpr" is undefined

static constexpr _Tp value = __v;

^

/usr/include/c++/4.6.1/type_traits(74): error: expected a ";"

static constexpr _Tp value = __v;

^

/usr/include/c++/4.6.1/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.1/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.1/type_traits(77): error: identifier "constexpr" is undefined

constexpr operator value_type() { return value; }

^

/usr/include/c++/4.6.1/type_traits(87): error: identifier "constexpr" is undefined

constexpr _Tp integral_constant<_Tp, __v>::value;

^

/usr/include/c++/4.6.1/type_traits(87): error: "_Tp" is not a function or static data member

constexpr _Tp integral_constant<_Tp, __v>::value;

^

/usr/include/c++/4.6.1/type_traits(644): error: identifier "__is_literal_type" is undefined

: public integral_constant

^

/usr/include/c++/4.6.1/type_traits(644): error: function call is not allowed in a constant expression

: public integral_constant

^

/usr/include/c++/4.6.1/type_traits(644): error: type name is not allowed

: public integral_constant

^

/usr/include/c++/4.6.1/type_traits(648): error: expected a ";"

typename add_rvalue_reference<_Tp>::type declval() noexcept;

^

/usr/include/c++/4.6.1/type_traits(695): error: identifier "noexcept" is undefined

{ static const bool __value = noexcept(_Tp(declval<_Args>()...)); };

^

/usr/include/c++/4.6.1/type_traits(695): error: function call is not allowed in a constant expression

{ static const bool __value = noexcept(_Tp(declval<_Args>()...)); };

^

/usr/include/c++/4.6.1/type_traits(695): error: function call is not allowed in a constant expression

{ static const bool __value = noexcept(_Tp(declval<_Args>()...)); };

^

/usr/include/c++/4.6.1/type_traits(700): error: identifier "noexcept" is undefined

static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>()));

^

/usr/include/c++/4.6.1/type_traits(700): error: function call is not allowed in a constant expression

static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>()));

^

/usr/include/c++/4.6.1/type_traits(700): error: function call is not allowed in a constant expression

static const bool __value = noexcept(static_cast<_Tp>(declval<_Arg>()));

^

/usr/include/c++/4.6.1/type_traits(1132): error: expected a ";"

declval() noexcept

^

/usr/include/c++/4.6.1/type_traits(1215): error: a template argument list is not allowed in a declaration of a primary template

struct result_of<_Functor(_ArgTypes...)>

^

/usr/include/c++/4.6.1/bits/stl_pair.h(75): error: identifier "constexpr" is undefined

constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();

^

/usr/include/c++/4.6.1/bits/stl_pair.h(75): error: expected a ";"

constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();

^

/usr/include/c++/4.6.1/bits/stl_pair.h(99): error: identifier "constexpr" is undefined

_GLIBCXX_CONSTEXPR pair()

^

/usr/include/c++/4.6.1/bits/stl_pair.h(99): error: member function with the same name as its class must be a constructor

_GLIBCXX_CONSTEXPR pair()

^

/usr/include/c++/4.6.1/bits/stl_pair.h(100): error: expected a ";"

: first(), second() { }

^

/usr/include/c++/4.6.1/bits/stl_pair.h(140): error: expected a ")"

pair(piecewise_construct_t,

^

/usr/include/c++/4.6.1/bits/stl_pair.h(140): error: not a valid member class or function template declaration

pair(piecewise_construct_t,

^

/usr/include/c++/4.6.1/bits/stl_pair.h(140): error: expected a ";"

pair(piecewise_construct_t,

^

/usr/include/c++/4.6.1/bits/stl_pair.h(200): error: "constexpr" is not a function or static data member

inline _GLIBCXX_CONSTEXPR bool

^

/usr/include/c++/4.6.1/bits/stl_pair.h(277): error: expected a ";"

} // namespace

^

/usr/include/c++/4.6.1/initializer_list(60): error: identifier "constexpr" is undefined

constexpr initializer_list(const_iterator __a, size_type __l)

^

/usr/include/c++/4.6.1/initializer_list(60): error: member function with the same name as its class must be a constructor

constexpr initializer_list(const_iterator __a, size_type __l)

^

/usr/include/c++/4.6.1/initializer_list(61): error: expected a ";"

: _M_array(__a), _M_len(__l) { }

^

/usr/include/c++/4.6.1/initializer_list(85): error: "constexpr" is not a function or static data member

constexpr const _Tp*

^

/usr/include/c++/4.6.1/initializer_list(98): error: expected a ";"

}

^

/usr/include/c++/4.6.1/bits/stl_iterator.h(717): error: identifier "constexpr" is undefined

_GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }

^

/usr/include/c++/4.6.1/bits/stl_iterator.h(717): error: member function with the same name as its class must be a constructor

_GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }

^

/usr/include/c++/4.6.1/bits/stl_iterator.h(717): error: expected a ";"

_GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }

^

/usr/include/c++/4.6.1/bits/char_traits.h(97): error: expected a ";"

static _GLIBCXX_CONSTEXPR bool

^

/usr/include/c++/4.6.1/bits/char_traits.h(123): error: member "__gnu_cxx::char_traits<_CharT>::constexpr" is not a type name

static _GLIBCXX_CONSTEXPR char_type

^

/usr/include/c++/4.6.1/bits/char_traits.h(123): error: "char_type" has already been declared in the current scope

static _GLIBCXX_CONSTEXPR char_type

^

/usr/include/c++/4.6.1/bits/char_traits.h(124): error: expected a ";"

to_char_type(const int_type& __c)

^

/usr/include/c++/4.6.1/bits/char_traits.h(147): error: class template "__gnu_cxx::char_traits<_CharT>" has no member "compare"

compare(const char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(147): error: identifier "char_type" is undefined

compare(const char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(147): error: identifier "char_type" is undefined

compare(const char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(160): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

length(const char_type* __p)

^

/usr/include/c++/4.6.1/bits/char_traits.h(160): error: declaration is incompatible with "std::size_t={unsigned long} __gnu_cxx::char_traits<_CharT>::length(const _CharT *)" (declared at line 109)

length(const char_type* __p)

^

/usr/include/c++/4.6.1/bits/char_traits.h(169): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

const typename char_traits<_CharT>::char_type*

^

/usr/include/c++/4.6.1/bits/char_traits.h(171): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

find(const char_type* __s, std::size_t __n, const char_type& __a)

^

/usr/include/c++/4.6.1/bits/char_traits.h(171): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

find(const char_type* __s, std::size_t __n, const char_type& __a)

^

/usr/include/c++/4.6.1/bits/char_traits.h(171): error: declaration is incompatible with "const _CharT *__gnu_cxx::char_traits<_CharT>::find(const _CharT *, std::size_t={unsigned long}, const _CharT &)" (declared at line 112)

find(const char_type* __s, std::size_t __n, const char_type& __a)

^

/usr/include/c++/4.6.1/bits/char_traits.h(180): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

typename char_traits<_CharT>::char_type*

^

/usr/include/c++/4.6.1/bits/char_traits.h(182): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

move(char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(182): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

move(char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(182): error: declaration is incompatible with "_CharT *__gnu_cxx::char_traits<_CharT>::move(_CharT *, const _CharT *, std::size_t={unsigned long})" (declared at line 115)

move(char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(189): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

typename char_traits<_CharT>::char_type*

^

/usr/include/c++/4.6.1/bits/char_traits.h(191): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

copy(char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(191): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

copy(char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(191): error: declaration is incompatible with "_CharT *__gnu_cxx::char_traits<_CharT>::copy(_CharT *, const _CharT *, std::size_t={unsigned long})" (declared at line 118)

copy(char_type* __s1, const char_type* __s2, std::size_t __n)

^

/usr/include/c++/4.6.1/bits/char_traits.h(199): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

typename char_traits<_CharT>::char_type*

^

/usr/include/c++/4.6.1/bits/char_traits.h(201): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

assign(char_type* __s, std::size_t __n, char_type __a)

^

/usr/include/c++/4.6.1/bits/char_traits.h(201): error: member "__gnu_cxx::char_traits<_CharT>::char_type" is not a type name

assign(char_type* __s, std::size_t __n, char_type __a)

^

/usr/include/c++/4.6.1/bits/char_traits.h(201): error: no instance of overloaded function "__gnu_cxx::char_traits<_CharT>::assign" matches the specified type

assign(char_type* __s, std::size_t __n, char_type __a)

^

/usr/include/c++/4.6.1/bits/char_traits.h(247): error: expected a ";"

static _GLIBCXX_CONSTEXPR bool

^

/usr/include/c++/4.6.1/bits/char_traits.h(318): error: expected a ";"

static _GLIBCXX_CONSTEXPR bool

^

/usr/include/c++/4.6.1/bits/char_traits.h(397): error: expected a ";"

static _GLIBCXX_CONSTEXPR bool

^

/usr/include/c++/4.6.1/bits/char_traits.h(490): error: expected a ";"

static _GLIBCXX_CONSTEXPR bool

^

/usr/include/c++/4.6.1/bits/allocator.h(212): error: identifier "constexpr" is undefined

constexpr allocator_arg_t allocator_arg = allocator_arg_t();

^

/usr/include/c++/4.6.1/bits/allocator.h(212): error: expected a ";"

constexpr allocator_arg_t allocator_arg = allocator_arg_t();

^

/usr/include/c++/4.6.1/tuple(69): error: identifier "constexpr" is undefined

constexpr _Head_base()

^

/usr/include/c++/4.6.1/tuple(69): error: member function with the same name as its class must be a constructor

constexpr _Head_base()

^

/usr/include/c++/4.6.1/tuple(70): error: expected a ";"

: _Head() { }

^

/usr/include/c++/4.6.1/tuple(93): error: identifier "constexpr" is undefined

constexpr _Head_base()

^

/usr/include/c++/4.6.1/tuple(93): error: member function with the same name as its class must be a constructor

constexpr _Head_base()

^

/usr/include/c++/4.6.1/tuple(94): error: expected a ";"

: _M_head_impl() { }

^

/usr/include/c++/4.6.1/tuple(157): error: identifier "constexpr" is undefined

constexpr _Tuple_impl()

^

/usr/include/c++/4.6.1/tuple(157): error: member function with the same name as its class must be a constructor

constexpr _Tuple_impl()

^

/usr/include/c++/4.6.1/tuple(158): error: expected a ";"

: _Inherited(), _Base() { }

^

/usr/include/c++/4.6.1/tuple(235): error: identifier "constexpr" is undefined

constexpr tuple()

^

/usr/include/c++/4.6.1/tuple(235): error: member function with the same name as its class must be a constructor

constexpr tuple()

^

/usr/include/c++/4.6.1/tuple(236): error: expected a ";"

: _Inherited() { }

^

/usr/include/c++/4.6.1/tuple(320): error: identifier "constexpr" is undefined

constexpr tuple()

^

/usr/include/c++/4.6.1/tuple(320): error: member function with the same name as its class must be a constructor

constexpr tuple()

^

/usr/include/c++/4.6.1/tuple(321): error: expected a ";"

: _Inherited() { }

^

/usr/include/c++/4.6.1/tuple(418): error: identifier "constexpr" is undefined

constexpr tuple()

^

/usr/include/c++/4.6.1/tuple(418): error: member function with the same name as its class must be a constructor

constexpr tuple()

^

/usr/include/c++/4.6.1/tuple(419): error: expected a ";"

: _Inherited() { }

^

/usr/include/c++/4.6.1/tuple(758): error: expected a ";"

const _Swallow_assign ignore{};

^

/usr/include/c++/4.6.1/tuple(788): error: class template "std::pair<_T1, _T2>" has no member "__cons"

__cons(tuple<_Args...>&& __tuple)

^

/usr/include/c++/4.6.1/tuple(799): error: class template "std::pair<_T1, _T2>" has no member "__do_cons"

__do_cons(tuple<_Args...>&& __tuple,

^

/usr/include/c++/4.6.1/functional(225): error: result_of is not a template

typename result_of<_Functor(_Args&&...)>::type

^

/usr/include/c++/4.6.1/functional(238): error: result_of is not a template

typename result_of<_Functor(_Args&&...)>::type

^

/usr/include/c++/4.6.1/functional(251): error: result_of is not a template

typename result_of<_Functor(_Args&&...)>::type

^

/usr/include/c++/4.6.1/functional(459): error: result_of is not a template

typename result_of<_Tp&(_Args&&...)>::type

^

/usr/include/c++/4.6.1/bits/unique_ptr.h(52): error: identifier "constexpr" is undefined

constexpr default_delete() = default;

^

/usr/include/c++/4.6.1/bits/unique_ptr.h(52): error: member function with the same name as its class must be a constructor

constexpr default_delete() = default;

^

/usr/include/c++/4.6.1/bits/unique_ptr.h(52): error: "= default" can only appear on default constructors, copy constructors, copy assignment operators, and destructors

constexpr default_delete() = default;

^

/usr/include/c++/4.6.1/bits/unique_ptr.h(73): error: identifier "constexpr" is undefined

constexpr default_delete() = default;

^

/usr/include/c++/4.6.1/bits/unique_ptr.h(73): error: member function with the same name as its class must be a constructor

constexpr default_delete() = default;

^

/usr/include/c++/4.6.1/bits/unique_ptr.h(73): error: "= default" can only appear on default constructors, copy constructors, copy assignment operators, and destructors

constexpr default_delete() = default;

^

/usr/include/c++/4.6.1/bits/unique_ptr.h(114): error: identifier "constexpr" is undefined

constexpr unique_ptr()

^

compilation aborted for YYY.cc (code 4)

make: *** [YYY.o] Error 4


0 Kudos
1 Solution
Judith_W_Intel
Employee
724 Views

Does specifying -U__GXX_EXPERIMENTAL_CXX0X__ on the command line help?

This should turn off C++0x extensions in the Gnu header files like constexpr which our compiler does not yet support.

Judy

View solution in original post

0 Kudos
5 Replies
TimP
Honored Contributor III
724 Views
Presumably, putting an older g++ (such as 4.4) on PATH might deal with this, if you don't need the newer C++ features. As your popular quotation suggests, look a little way into the past.
0 Kudos
Judith_W_Intel
Employee
725 Views

Does specifying -U__GXX_EXPERIMENTAL_CXX0X__ on the command line help?

This should turn off C++0x extensions in the Gnu header files like constexpr which our compiler does not yet support.

Judy
0 Kudos
phopon
Beginner
724 Views
I assume I have the same problem as parent. When using the undefine it works to get rid of the above errors but it disables most of the "supported" c++0x features in icpc. I can reenable them by creating my own headers and defining the parts of the gnu headers that I need not protected by the __GXX tag, but this is rather onerous.
0 Kudos
Judith_W_Intel
Employee
724 Views

Yes it would have been nice ifthe authors of the Gnu C++ libraryhad conditionalized each C++0x feature in their headers with a different macro so the Intel compiler could have turned on justthe ones we support.

Unfortunately Intel 12.1 does not support some of the C++0xfeatures inGNU 4.6 and later. It is very hard to keep ahead or even stay evenwith the latestGNU versions. Sorry for the inconvenience.

If you use GNU 4.5 or earlier you should be ok.

Judy
0 Kudos
YannGolanski
Beginner
724 Views

Does specifying -U__GXX_EXPERIMENTAL_CXX0X__ on the command line help?

This should turn off C++0x extensions in the Gnu header files like constexpr which our compiler does not yet support.

Judy

The switch -U__GXX_EXPERIMENTAL_CXX0X__ worked fine. Thank you.
0 Kudos
Reply