Use Intel C/C++ compilers V12.0.1.107 or higher version to resolve error when preprocessing and then compiling C++ language code which included math.h or mathimf.h header

Version:

Intel® C/C++ compilers V11.0 and earlier, and Intel® C/C++ compilers V12.0 built before 2010/10/29.

Product:

Intel® C/C++ compiler

Operating System:

Linux and MAC OS* X

Problem Description:

 

C++ language code using math.h or mathimf.h header file cannot be compiled by Intel® C/C++ compilers V11.0 and earlier version if it was first preprocessed to separate file and then compiled. The reason is that in C++ language, exception specification of functions corresponding to ISO C classification macros differs in GNU and Intel® math headers.

 

Consider as an example the following test.cpp file:

#include <math.h>

int foo() {

    float x=1.0;

    return (int)expf(x);

}

It can be preprocessed to file test1.cpp by the following command:

icc test.cpp -EP -o test1.cpp

But the new file fails to compile:

icc -c test1.cpp

It produces the errors like:

test1.cpp(1659): error: omission of exception specification is incompatible with previous function "__fpclassifyf" (declared at line 1146)

  extern int __fpclassifyf  ( float              __x );

 


Resolution Status:

The problem has been fixed in Intel® C/C++ compilers built after 2010/10/28, i.e. V12.0.1.107 or higher version. See /en-us/articles/intel-composer-xe for download.

Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.