# Unsupported compiler error when linking with Intel compiler

**URL:** https://discourse.itk.org/t/unsupported-compiler-error-when-linking-with-intel-compiler/3709
**Category:** Engineering
**Created:** [December 16, 2020, 3:54pm UTC](https://discourse.itk.org/t/unsupported-compiler-error-when-linking-with-intel-compiler/3709 "2020-12-16T15:54:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Fijoy\_Vadakkumpadan](https://discourse.itk.org/user_avatar/discourse.itk.org/fijoy_vadakkumpadan/32/1287_2.png) [@Fijoy\_Vadakkumpadan](https://discourse.itk.org/u/Fijoy_Vadakkumpadan)
#### Post date: [December 16, 2020, 3:54pm UTC](https://discourse.itk.org/t/unsupported-compiler-error-when-linking-with-intel-compiler/3709/1 "2020-12-16T15:54:20Z")

</div>

Hello,

I successfully built ITK 5.1.1 static libraries with gcc 7.4, but having an issue linking them to my application, which uses an Intel compiler.

I’m getting an “Unsupported compiler” error thrown by the generated include file itk\_compiler\_detection.h from this conditional (starting at line 153 in my build):

**# if ITK\_COMPILER\_IS\_GNU**  
**# include "compilers/ITK\_COMPILER\_INFO\_GNU\_CXX.h"**  
**# else**  
**# error Unsupported compiler**  
**# endif**

Looking through the preceding code in that file, I’m seeing that ITK\_COMPILER\_IS\_GNU is not set to 1 if \_\_INTEL\_COMPILER or \_\_ICC is defined.

To confirm the source of the issue, I changed the conditional above to this:  
**# if ITK\_COMPILER\_IS\_GNU || ITK\_COMPILER\_IS\_Intel**

and the “Unsupported compiler” error went away.

Since modifying a generated file isn’t a good solution, is there a bug in ITK CMake files that causes the build to generate files that don’t accommodate linking with an Intel compiler? If yes, can we resolve it?

If not, did I miss some CMake configuration setting that can be used to eliminate this issue?

Attaching my full itk\_compiler\_detection.h file for reference:  
[itk\_compiler\_detection.h.bak](https://discourse.itk.org/uploads/short-url/944NFWBtgCa5RAYvKTSQBGYJwOv.bak) (7.8 KB)

Thanks a lot.

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [December 17, 2020, 8:52pm UTC](https://discourse.itk.org/t/unsupported-compiler-error-when-linking-with-intel-compiler/3709/2 "2020-12-17T20:52:57Z")

</div>

@hjmjohnson @phcerdan I think we already encountered this problem before, but I can’t find that discussion.

---

<div class="post-metadata">

### Author: ![Fijoy\_Vadakkumpadan](https://discourse.itk.org/user_avatar/discourse.itk.org/fijoy_vadakkumpadan/32/1287_2.png) [@Fijoy\_Vadakkumpadan](https://discourse.itk.org/u/Fijoy_Vadakkumpadan)
#### Post date: [December 17, 2020, 9:12pm UTC](https://discourse.itk.org/t/unsupported-compiler-error-when-linking-with-intel-compiler/3709/3 "2020-12-17T21:12:05Z")

</div>

@dzenanz, I just found this thread:[2 errors when trying to build Unity+MagicLeap plugin](https://discourse.itk.org/t/2-errors-when-trying-to-build-unity-magicleap-plugin/3066)  
Is that the one you’re referring to?

One suggestion in that thread is to use the same compiler for ITK and the application. At the same time, Intel compilers are supposed to be interoperable with GCC. Intel compilers define both \__GNUC_\_ and \_\_INTEL\_COMPILER for example. Perhaps this should be accommodated in the ITK CMake logic? Meaning, the itk\_compiler\_detection.h should set ITK\_COMPILER\_IS\_GNU also in addition to ITK\_COMPILER\_IS\_Intel, if it’s an Intel compiler.

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [December 17, 2020, 9:24pm UTC](https://discourse.itk.org/t/unsupported-compiler-error-when-linking-with-intel-compiler/3709/4 "2020-12-17T21:24:39Z")

</div>

> [@Fijoy\_Vadakkumpadan](#):
>
> use the same compiler for ITK and the application

That is the simplest solution.

But I think there were some other discussions, specifically for GCC+Intel. I don’t remember whether there is a way to use that, or conclusion was to build ITK and your application using the same compiler.
