If you use makefiles to build your gcc application, you need to change the value for the CC compiler variable to use the Intel compiler. You may also want to review the options specified by CFLAGS. A simple example follows:
# Use gcc compiler # Compile-time flags all: area_app area_app: area_main.o area_functions.o $(CC) area_main.o area_functions.o -o area area_main.o: area_main.c $(CC) -c $(CFLAGS) area_main.c area_functions.o: area_functions.c $(CC) -c -fno-asm $(CFLAGS) area_functions.c clean: rm -rf *o area |
Changes to the gcc makefile are highlighted in yellow.
# Use Intel C compiler # Compile-time flags. all: area-app area-app: area_main.o area_functions.o $(CC) area_main.o area_functions.o -o area area_main.o: area_main.c $(CC) -c $(CFLAGS) area_main.c area_functions.o: area_functions.c gcc -c -O2 -fno-asm $(CFLAGS) area_functions.c clean: rm -rf *o area |
If your gcc code includes features that are not supported with the Intel compiler, such as compiler options, language extensions, macros, pragmas, etc., you can compile those sources separately with gcc if necessary.
In the above makefile, area_functions.c is an example of a source file that includes features unique to gcc. Since the Intel compiler uses the -O2 compiler option by default and gcc's default is -O0, we instruct gcc to compile with -O2. We also include the -fno-asm switch from the original makefile since this switch is not supported with the Intel compiler. With the modified makefile, the output of make is:
icc -c -std=c99 area_main.c
gcc -c -O2 -fno-asm -std=c99 area_functions.c
icc area_main.o area_functions.o -o area