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

compilation error regarding cmath

Ctech_Ctech
Beginner
227 Views
Hi All,

I am trying to compile my C++ application using icc.

However, I get the following error:


icc -g -fPIC -O2 -c -I ./incFolder -o myapp.o myapp.cpp
/usr/include/c++/4.4.1/cmath(500): error: identifier "__builtin_fpclassify" is undefined
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
^
detected during:
instantiation of "__gnu_cxx::__enable_if<:__IS_ARITHMETIC><_Tp>::__value, int>::__type std::fpclassify(_Tp) [with _Tp=float]" at line 65 of "/usr/include/boost/functional/hash/detail/hash_float.hpp"
instantiation of "size_t={unsigned long} boost::hash_detail::float_hash_value(T) [with T=float]" at line 282 of "/usr/include/boost/functional/hash/hash.hpp"

/usr/include/c++/4.4.1/cmath(500): error: identifier "__builtin_fpclassify" is undefined
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
^
detected during:
instantiation of "__gnu_cxx::__enable_if<:__IS_ARITHMETIC><_Tp>::__value, int>::__type std::fpclassify(_Tp) [with _Tp=long double]" at line 65 of "/usr/include/boost/functional/hash/detail/hash_float.hpp"
instantiation of "size_t={unsigned long} boost::hash_detail::float_hash_value(T) [with T=long double]" at line 292 of "/usr/include/boost/functional/hash/hash.hpp"

compilation aborted for myapp.cpp (code 2)


By the way, I do not get this error when compiling my application using gcc.

How can I resolve it ?

Thanks.
0 Kudos
1 Reply
Milind_Kulkarni__Int
New Contributor II
227 Views

This is a known problem with many new builtin functions that are provided in new versions of g++.

For a relevant issue in Intel Software Network, please visit this link:--

http://software.intel.com/en-us/forums/intel-c-compiler/topic/64188/

Following workarounds:--

1) If you try with g++ 4.3.2 and earlier, this error would not come.
current icpc supports g++ 4.2.1 headers, but probably not current g++. Due to the great divergence between C99 and C++, I suppose it's difficult to tie down all the loose ends.

Also check this link:--

http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

indicates that the treatment of built-ins should depend on -std= setting. icc supports only a minimal subset of the gcc -std= options (not, for example, the -std=gnuxx), and those not apparently in accordance with gcc documentation on built-ins.

2) You can as well try to use intel hearder instead of , and see whether this works, because it worked for me for a few cases including this.

Also, this has already been raised as a bug, and was supposed to be fixed in latest 11.1, though I do not know why this still is not.

Regards

0 Kudos
Reply