icc 12.0.4 c++0x error

icc 12.0.4 c++0x error

Hi,

I am trying to use icc 12.0.4 on a Debian 6 system. I am getting the following error:

/usr/include/c++/4.4.5/c++0x_warning.h(31): catastrophic error: #error directive: This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
#error This file requires compiler and library support for the upcoming

The same code works when compiled with g++.

I think this is because in c++0x_warning.h, we have:

30 #ifndef __GXX_EXPERIMENTAL_CXX0X__
31 #error This file requires compiler ...
...
#endif

which is not being defined by icc?

Kindly help me solve this...

Thanks

17 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

please note that I am tried passing the -std=c++0x option to icc, also tried with -std=gnu++0x.

Best Reply

You could set -std=c++0x -D__GXX_EXPERIMENTAL_CXX0X__ until such time as g++ and icpc come up with a better define to distinguish C++0x option setting, as they've admitted should happen.

Hi TimP,

Thanks for the answer.

Is there any documentation of how I could use icc with GCC 4.4.5 on Debian. I ask this because after I fixed this error as per your suggestions, I am getting the following errors. I understand from the forums that these are because of the gcc version I am using:

$ icc -std=c++0x -D__GXX_EXPERIMENTAL_CXX0X__ -c Analyzer.cpp
/usr/include/c++/4.4.5/bits/stringfwd.h(67): error: identifier "char16_t" is undefined
template<> struct char_traits;
^

/usr/include/c++/4.4.5/bits/stringfwd.h(68): error: identifier "char32_t" is undefined
template<> struct char_traits;

....

Any pointer to previous forums or any other documentation would really be helpful!

Thanks,

First of all, the extent to which icpc (or g++) can second guess your decision to compile C++ with a C compiler is limited. Perhaps it's a bug that icc doesn't complain about the c++0x option, but it seems unlikely to work. gcc, of course, would make that option effective only to the extent that it switches to g++. If the header problem is caused by your intentional mixing of C++ and C, you can't expect anyone to change it for you.

You're getting the error when using icc. Did you try using icpc (brings in the right C++ defines and libs) instead?

To build with different versions of gcc try -gcc-version=n where n is the gcc versions as listed in the compiler users guide (e.g. 411 for gcc 4.11, 420 for gcc 4.2, etc).

--mark

Sorry for digging up an old thread, but I once again am encountering this error. I did not solve this earlier either. Please find the details below:

$ icpc --version
icpc (ICC) 12.1.5 20120612
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.

$ g++ --version
g++ (Ubuntu/Linaro 4.7.0-7ubuntu3) 4.7.0
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ icpc -Wall -lpthread -lrt -O3 -DNDEBUG -openmp -std=c++0x -D__GXX_EXPERIMENTAL_CXX0X__ -ltbb -c -o SuitabilityAnalyzer.o SuitabilityAnalyzer.cpp
Warning #2928: the __GXX_EXPERIMENTAL_CXX0X__ macro is disabled when using GNU version 4.6 with the c++0x option

/usr/include/c++/4.7/bits/move.h(47): error: expected a ";"
__addressof(_Tp& __r) _GLIBCXX_NOEXCEPT
^

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

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

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

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

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

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

/usr/include/c++/4.7/type_traits(72): error: "_Tp" is not a function or static data member
constexpr _Tp integral_constant<_Tp, __v>::value;
^

/usr/include/c++/4.7/type_traits(519): error: identifier "__is_literal_type" is undefined
: public integral_constant
^

/usr/include/c++/4.7/type_traits(519): error: function call is not allowed in a constant expression
: public integral_constant
^

/usr/include/c++/4.7/type_traits(519): error: type name is not allowed
: public integral_constant
^

/usr/include/c++/4.7/type_traits(578): error: expected a ";"
typename add_rvalue_reference<_Tp>::type declval() noexcept;
^

/usr/include/c++/4.7/type_traits(808): error: expected a ";"
static constexpr bool value = type::value;
^

/usr/include/c++/4.7/type_traits(833): error: expected a ";"
static constexpr bool value = type::value;
^

/usr/include/c++/4.7/type_traits(959): error: identifier "noexcept" is undefined
: public integral_constant
^

/usr/include/c++/4.7/type_traits(959): error: function call is not allowed in a constant expression
: public integral_constant
^

/usr/include/c++/4.7/type_traits(986): error: function call is not allowed in a constant expression
: public integral_constant()...))>
^

/usr/include/c++/4.7/type_traits(986): error: function call is not allowed in a constant expression
: public integral_constant()...))>
^

/usr/include/c++/4.7/type_traits(992): error: function call is not allowed in a constant expression
noexcept(static_cast<_Tp>(declval<_Arg>()))>
^

/usr/include/c++/4.7/type_traits(992): error: function call is not allowed in a constant expression
noexcept(static_cast<_Tp>(declval<_Arg>()))>
^

/usr/include/c++/4.7/type_traits(1055): error: expected a ";"
static constexpr bool value = sizeof(__test<_Tp, _Up>(0)) == 1;
^

/usr/include/c++/4.7/type_traits(1103): error: function call is not allowed in a constant expression
: public integral_constant() = declval<_Up>())>
^

/usr/include/c++/4.7/type_traits(1103): error: function call is not allowed in a constant expression
: public integral_constant() = declval<_Up>())>
^

/usr/include/c++/4.7/type_traits(1103): error: this operator is not allowed in a constant expression
: public integral_constant() = declval<_Up>())>
^

/usr/include/c++/4.7/type_traits(1103): error: function call is not allowed in a constant expression
: public integral_constant() = declval<_Up>())>
^

/usr/include/c++/4.7/type_traits(1241): error: expected a ";"
{ static constexpr bool value = is_void<_To>::value; };
^

/usr/include/c++/4.7/type_traits(1258): error: expected a ";"
static constexpr bool value = sizeof(__test<_From, _To>(0)) == 1;
^

/usr/include/c++/4.7/type_traits(1762): error: expected a ";"
typedef __underlying_type(_Tp) type;
^

/usr/include/c++/4.7/type_traits(1774): error: expected a ";"
declval() noexcept
^

/usr/include/c++/4.7/type_traits(1857): error: a template argument list is not allowed in a declaration of a primary template
struct result_of<_Functor(_ArgTypes...)>
^

/usr/include/c++/4.7/bits/move.h(76): error: identifier "constexpr" is undefined
constexpr _Tp&&
^

/usr/include/c++/4.7/bits/move.h(76): error: "_Tp" is not a function or static data member
constexpr _Tp&&
^

/usr/include/c++/4.7/bits/move.h(121): error: identifier "__move_if_noexcept_cond" is undefined
conditional<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type
^

/usr/include/c++/4.7/bits/move.h(121): error: type name is not allowed
conditional<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type
^

/usr/include/c++/4.7/bits/move.h(121): error: too few arguments for class template "std::conditional"
conditional<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type
^

/usr/include/c++/4.7/bits/move.h(141): error: expected a ";"
} // namespace
^

/usr/include/c++/4.7/bits/move.h(169): error: expected a ";"
noexcept(__and_,
^

/usr/include/c++/4.7/bits/stl_pair.h(76): error: identifier "constexpr" is undefined
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
^

/usr/include/c++/4.7/bits/stl_pair.h(76): error: expected a ";"
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
^

/usr/include/c++/4.7/bits/stl_pair.h(100): error: identifier "constexpr" is undefined
_GLIBCXX_CONSTEXPR pair()
^

/usr/include/c++/4.7/bits/stl_pair.h(100): error: member function with the same name as its class must be a constructor
_GLIBCXX_CONSTEXPR pair()
^

/usr/include/c++/4.7/bits/stl_pair.h(101): error: expected a ";"
: first(), second() { }
^

/usr/include/c++/4.7/bits/stl_pair.h(123): error: expected a ";"
noexcept(__and_,
^

/usr/include/c++/4.7/bits/stl_pair.h(165): error: expected a ";"
noexcept(__and_,
^

/usr/include/c++/4.7/bits/stl_pair.h(211): error: "constexpr" is not a function or static data member
inline _GLIBCXX_CONSTEXPR bool
^

/usr/include/c++/4.7/bits/stl_pair.h(289): error: expected a ";"
} // namespace
^

/usr/include/c++/4.7/bits/stl_iterator_base_types.h(143): error: expected a ";"
_GLIBCXX_HAS_NESTED_TYPE(iterator_category)
^

/usr/include/c++/4.7/bits/stl_iterator.h(725): error: identifier "constexpr" is undefined
_GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }
^

/usr/include/c++/4.7/bits/stl_iterator.h(725): 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.7/bits/stl_iterator.h(725): error: expected a ";"
_GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }
^

/usr/include/c++/4.7/bits/stl_iterator.h(1130): error: identifier "__move_if_noexcept_cond" is undefined
= typename conditional<__move_if_noexcept_cond
^

/usr/include/c++/4.7/bits/stl_iterator.h(1131): error: type name is not allowed
::value_type>::value,
^

/usr/include/c++/4.7/bits/stl_iterator.h(1131): error: too few arguments for class template "std::conditional"
::value_type>::value,
^

/usr/include/c++/4.7/bits/stl_iterator.h(1132): error: a nontype template parameter may not have class type
_Iterator, move_iterator<_Iterator>>::type>
^

/usr/include/c++/4.7/bits/stl_iterator.h(1132): error: the global scope has no "type"
_Iterator, move_iterator<_Iterator>>::type>
^

/usr/include/c++/4.7/bits/stl_iterator.h(1140): error: expected a ";"
} // namespace
^

/usr/include/c++/4.7/bits/char_traits.h(97): error: expected a ";"
static _GLIBCXX_CONSTEXPR bool
^

/usr/include/c++/4.7/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.7/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.7/bits/char_traits.h(124): error: expected a ";"
to_char_type(const int_type& __c)
^

/usr/include/c++/4.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/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.7/bits/char_traits.h(244): error: expected a ";"
assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT
^

/usr/include/c++/4.7/bits/char_traits.h(315): error: expected a ";"
assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT
^

/usr/include/c++/4.7/bits/char_traits.h(394): error: expected a ";"
assign(char_type& __c1, const char_type& __c2) noexcept
^

/usr/include/c++/4.7/bits/char_traits.h(487): error: expected a ";"
assign(char_type& __c1, const char_type& __c2) noexcept
^

/usr/include/c++/4.7/exception(65): error: expected a ";"
exception() _GLIBCXX_USE_NOEXCEPT { }
^

/usr/include/c++/4.7/exception(70): error: expected a ";"
virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
^

/usr/include/c++/4.7/exception(78): error: expected a ";"
bad_exception() _GLIBCXX_USE_NOEXCEPT { }
^

/usr/include/c++/4.7/exception(85): error: expected a ";"
virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
^

/usr/include/c++/4.7/exception(95): error: expected a "{"
terminate_handler set_terminate(terminate_handler) _GLIBCXX_USE_NOEXCEPT;
^

/usr/include/c++/4.7/new(97): error: expected a "{"
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
^

/usr/include/c++/4.7/new(112): error: identifier "__p" is undefined
{ return __p; }
^

/usr/include/c++/4.7/new(113): error: expected a "{"
inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
^

/usr/include/c++/4.7/new(117): error: expected a "{"
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
^

/usr/include/c++/4.7/new(118): error: expected a "{"
inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
^

/usr/include/c++/4.7/ext/new_allocator.h(69): error: expected a ";"
new_allocator() _GLIBCXX_USE_NOEXCEPT { }
^

/usr/include/c++/4.7/bits/allocator.h(89): error: namespace "std::__gnu_cxx" has no member class "new_allocator"
class allocator: public __glibcxx_base_allocator<_Tp>
^

/usr/include/c++/4.7/bits/allocator.h(89): error: not a class or struct name
class allocator: public __glibcxx_base_allocator<_Tp>
^

/usr/include/c++/4.7/bits/allocator.h(89): error: class or struct definition is missing
class allocator: public __glibcxx_base_allocator<_Tp>
^

/usr/include/c++/4.7/bits/allocator.h(144): error: incomplete type is not allowed
extern template class allocator;
^

icc 13.0 should release with gcc-4.7 support in about a month.

I have the same issue with g++ 4.6 too. Is it a c++0x issue?

Can you attach a preprocessed file (.i) that we can use to reproduce the errors you are getting?
You can generate the file by adding "-P" to your compilation options.

Thanks,
--mark

Please find the pre-processed file attached.

Attachments: 

AttachmentSize
Download SuitabilityAnalyzer.i1.83 MB

Thanks for the test case. Does the file compile fine with gcc 4.6 or 4.7?

--mark

No, I used TBB and Cilk in this project. It compiled fine in VS2010 with the Intel Compiler. I am currently trying to port it to work on Linux.

Warning #2928: the __GXX_EXPERIMENTAL_CXX0X__ macro is disabled when using GNU version 4.6 with the c++0x option

The reason for the above warning is thatin 12.1 we dont support all the C++11 features needed by the GNU 4.6 headers, namely noexcept, constexpr, etc.

You aretrying to re-enable the macro on the command line themselves but that wont work.

This is documented in section 3.5.1 of the release notes here:

http://software.intel.com/file/44749

Youshould upgrade to 13.0 compiler ifyou want to use g++ 4.6 with the std=c++0x option. The 13.0 compiler is scheduled to release in a month or so (schedules subject to change).

Ok. I will wait for the 13.0 release. I guess sharing the header files with GCC is the root of the problem here, in that the latest release of Intel Compilers and GCC are out of step with regards to supporting C++0x.

Thanks a lot!

bustaf's picture

Hi

i have read speedily this exchange
I read (/usr/include/c++/4.4.5/c++0x_warning.h(31): catastrophic error: #error directive:)
You have ICC compiler (12) linked with an GNU compiler (4.4.5).
It's the GNU compiler that you must upgrade to 4.6.X for using ICC 12.X
ICC 13 require headers Gnu Compiler version 4.7.X ,I think ...
If you add new compiler Gnu relation two compilers depend (gcc g++) short name
link that are on (/usr/bin)
You can build source Gnu 4.7.1 on debian 6 it's easy and is working very very well.
Also Debian 7 Wheezy have default Gcc 4.7.X (without Cloog) that could work perfectly this side ..

Debian 7 Wheezy working perfectly just It's team Debian always very very picky before
it's accepted official.

Regards

Hi Bustaf, the combinations you mentioned were from a while ago. The recent attempt used gcc-4.7.0

Login to leave a comment.