Community
cancel
Showing results for 
Search instead for 
Did you mean: 
applemax82
Beginner
362 Views

how to solve the compiling error of misusing wrong header

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
Black Belt
362 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.

Reply