# itk doesn't work with c++17

**URL:** <https://discourse.itk.org/t/itk-doesnt-work-with-c-17/1911>\
**Category:** Beginner Questions\
**Created:** [May 26, 2019, 11:55am UTC](https://discourse.itk.org/t/itk-doesnt-work-with-c-17/1911 "2019-05-26T11:55:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eninyo](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/f9ae1b/32.png) [@eninyo](https://discourse.itk.org/u/eninyo)\
**Post date:** [May 26, 2019, 11:55am UTC](https://discourse.itk.org/t/itk-doesnt-work-with-c-17/1911/1 "2019-05-26T11:55:44Z")

</div>

hello,  
i’m using the itkImageAlgorithm H file and i get the following error:  
itkImageAlgorithm.h:193: error: C2143: syntax error: missing ‘,’ before ‘\<’

this is the code:  
/\*\* Unary functor just for static\_cast operator \*/  
template\<typename TInputType, typename TOutputType\>  
struct StaticCast  
: public std::unary\_function\<TInputType,TOutputType\>  
{  
TOutputType operator() (const TInputType i) { return static\_cast(i); }  
};

any suggestions?

---

<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 27, 2019, 12:41pm UTC](https://discourse.itk.org/t/itk-doesnt-work-with-c-17/1911/2 "2019-05-27T12:41:45Z")

</div>

Which version of ITK are you trying to use it with, 4.13.2 or 5.0.0? Also, I don’t think expression `static_cast(i)` is [valid](https://en.cppreference.com/w/cpp/language/static_cast) in any version of C++.

---

<div class="post-metadata">

**Author:** ![eninyo](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/f9ae1b/32.png) [@eninyo](https://discourse.itk.org/u/eninyo)\
**Post date:** [May 27, 2019, 1:07pm UTC](https://discourse.itk.org/t/itk-doesnt-work-with-c-17/1911/3 "2019-05-27T13:07:56Z")

</div>

hi,  
i’m using ITK 4.13.2 and not 5.

the issue is in ITK code and not my code. in my project i simply tried to set the c++ to be 17 instead of 11 and this is one of the many errors i got.

do you have a project that uses ITK 4.13.2 with c++17 as the compiler?

---

<div class="post-metadata">

**Author:** ![fbudin](https://discourse.itk.org/user_avatar/discourse.itk.org/fbudin/32/14_2.png) [@fbudin](https://discourse.itk.org/u/fbudin)\
**Post date:** [May 27, 2019, 2:04pm UTC](https://discourse.itk.org/t/itk-doesnt-work-with-c-17/1911/4 "2019-05-27T14:04:00Z")

</div>

The std function called in ITK on the line causing an issue has been removed in C++17 (see [here](https://en.cppreference.com/w/cpp/utility/functional/unary_function)). This line has been removed in ITKv5, so to solve your problem you can either move to ITKv5 or patch ITKv4.13.2 for your project and simply remove this line of code.
