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

how to solve the compiling error of misusing wrong header

applemax82
Beginner
1,221 Views

Hi,

I use gcc to build some project on centos 6, where 'icc (ICC) 14.0.2 20140120' has been installed.

I add the following script to ~/.bash_profile to set some environment:

export CC=icc
export CXX=icpc
export LD=xild
export CFLAGS="-std=gnu99 -O3 -ip -restrict -xSSE3 -axSSE3,SSSE3,SSE4.1,SSE4.2"
export CXXFLAGS=" -O3 -ip -restrict -xSSE3 -axSSE3,SSSE3,SSE4.1,SSE4.2"
export CPPFLAGS="-I/opt/intel/include"
export LDFLAGS="-L/opt/intel/lib -L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64"
source /opt/intel/composer_xe_2013_sp1/bin/compilervars.sh intel64
source /opt/intel/ipp/bin/ippvars.sh intel64

 

But gcc is used to build some project by using ./configure CC=gcc, and then 'make' will report error as shown below:

gcc -DHAVE_CONFIG_H -I. -I../..   -I/opt/intel/include  -std=gnu99 -O3 -MT file1.o -MD -MP -MF .deps/file1.Tpo -c -o file1.o file1.c
In file included from file2.h:6,
                 from file1.c:2:
/opt/intel/include/math.h:29:3: error: #error "This Intel <math.h> is for use with only the Intel compilers!"

 

It seems gcc building system will use Intel's math.h instead of system's math.h. How to build project by using gcc under the environment where icc is installed?

Thanks!

Andrew

 

 

0 Kudos
1 Reply
TimP
Honored Contributor III
1,221 Views

It seems that your specification of -I/opt/intel/include may take precedence over gcc's own default include path, so you may wish to remove that option.  It might depend on linking against icc libraries as well as those which gcc normally uses.

0 Kudos
Reply