# weird compile errors when setting -DCMAKE\_CXX\_STANDARD=17

**URL:** https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094
**Category:** Beginner Questions
**Tags:** python
**Created:** [May 19, 2020, 10:24pm UTC](https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094 "2020-05-19T22:24:31Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kayarre](https://discourse.itk.org/user_avatar/discourse.itk.org/kayarre/32/669_2.png) [@kayarre](https://discourse.itk.org/u/kayarre)
#### Post date: [May 19, 2020, 10:24pm UTC](https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094/1 "2020-05-19T22:24:31Z")

</div>

gcc-10 on ubuntu 18.04

When the python wrappers are selected be built and `CMAKE_CXX_STANDARD=17` I get weird error about type\_traits way down low in the c++ standard library. I think it has to do with the python bindings may be hard coding `std=c++11`.

I am not totally sure I understand what the issue is, but gives and error like

```auto
_Tp does not refer to a value 
// referencing this code snippet in type_traits
: public integral_constant<bool, _GLIBCXX_BUILTIN_IS_SAME_AS(_Tp, _Up)>

```

there were some other issues around `throw(itk::object)` which I replaced with `noexcept(false)` but that didn’t seemed relevant to the issue above.

I also turned off the python bindings and it appears to be compiling fine.

---

<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: [May 20, 2020, 12:19pm UTC](https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094/2 "2020-05-20T12:19:48Z")

</div>

[SWIG’s docs](http://www.swig.org/Doc4.0/CPlusPlus17.html#CPlusPlus17) say:

> … work has only just begun on adding C++17 support. SWIG-4.0.0 is the first version to support any C++17 features.

---

<div class="post-metadata">

### Author: ![kayarre](https://discourse.itk.org/user_avatar/discourse.itk.org/kayarre/32/669_2.png) [@kayarre](https://discourse.itk.org/u/kayarre)
#### Post date: [May 20, 2020, 3:06pm UTC](https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094/3 "2020-05-20T15:06:02Z")

</div>

that is very helpful, from pursuing it looked like itk should compile with 17 just fine, but didn’t think about it interfering with swig wrapping.

---

<div class="post-metadata">

### Author: ![kayarre](https://discourse.itk.org/user_avatar/discourse.itk.org/kayarre/32/669_2.png) [@kayarre](https://discourse.itk.org/u/kayarre)
#### Post date: [May 28, 2020, 1:45pm UTC](https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094/4 "2020-05-28T13:45:18Z")

</div>

it appears to give the same error when `CMAKE_CXX_STANDARD` is not set. which I would assume get set to a default?

the latest cmake sets it to 14, which appears to be the same issue.

also I believe I am compiling with swig 3.x (the default), maybe using external 4.x would fix. Is it in the works to upgrade swig to 4.x in the default build settings?

I found that the default build uses swig 3.x on unix. after modifying to use 4.x the build produces the same issue.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [June 11, 2020, 1:02pm UTC](https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094/5 "2020-06-11T13:02:36Z")

</div>

> [@kayarre](#):
>
> gcc-10 on ubuntu 18.04

Hi @kayarre,

How was gcc-10 installed? I would like to reproduce the issue.

Thanks,  
Matt

---

<div class="post-metadata">

### Author: ![kayarre](https://discourse.itk.org/user_avatar/discourse.itk.org/kayarre/32/669_2.png) [@kayarre](https://discourse.itk.org/u/kayarre)
#### Post date: [June 11, 2020, 6:33pm UTC](https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094/6 "2020-06-11T18:33:50Z")

</div>

on Ubuntu 18.04 I used the apt repo ubuntu-toolchaing-r/test

apt install gcc-10 g+±10 gfortran-10.  
Kurt

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [June 16, 2020, 2:32am UTC](https://discourse.itk.org/t/weird-compile-errors-when-setting-dcmake-cxx-standard-17/3094/7 "2020-06-16T02:32:07Z")

</div>

Thanks, Kurt. I was able to reproduce the error.

This patch addresses the build errors:

> <https://github.com/InsightSoftwareConsortium/ITK/pull/1876>

We use CastXML to parse the C++ headers to generate the wrapping interface. CastXML uses LLVM for syntax parsing. This version bumps LLVM from 6 to 10 to improve syntax support for GCC 10.
