# Building ITK: Error With Algorithim Module

**URL:** https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927
**Category:** Beginner Questions
**Tags:** itk, cmake
**Created:** [May 8, 2023, 4:20am UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927 "2023-05-08T04:20:20Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ramen-newdals](https://discourse.itk.org/user_avatar/discourse.itk.org/ramen-newdals/32/3453_2.png) [@ramen-newdals](https://discourse.itk.org/u/ramen-newdals)
#### Post date: [May 8, 2023, 4:20am UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/1 "2023-05-08T04:20:20Z")

</div>

Hello ITK Community,

I am attempting to rebuild the ITK project. I had a successful build on the same system before, but I am having problems with this rebuild (The previous build was completed with the VMTK super build tool).

Build Details: commit 79a2823dcd51489a926beb98edb89df60b629c39

CMake configures all elements correctly, but when I run

```auto
make -j 10

```

I get a wall of errors when I reach the itkMathematicalMorphologyEnums.cxx file all saying something along the lines of:

```auto
error: use of enum ‘Algorithm’ without previous declaration

```

I am not really sure how to approach this error as it looks like modification of the ITK source is required, but I am not experienced in it.

Thanks for any help in resolving this!

---

<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 8, 2023, 1:38pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/2 "2023-05-08T13:38:10Z")

</div>

Which compiler are you using, and what exact version? Please copy the entire error message with notes, in particular the source file and line where it occurs.

---

<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 8, 2023, 1:41pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/3 "2023-05-08T13:41:18Z")

</div>

`itkMathematicalMorphologyEnums.h` and `itkMathematicalMorphologyEnums.cxx` are so short and simple, it is hard to tell why anything would go wrong there.

---

<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 8, 2023, 1:42pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/4 "2023-05-08T13:42:35Z")

</div>

Maybe on 25, replace `const MathematicalMorphologyEnums::Algorithm value` by `const typename MathematicalMorphologyEnums::Algorithm value` (note the addition of `typename`).

---

<div class="post-metadata">

### Author: ![ramen-newdals](https://discourse.itk.org/user_avatar/discourse.itk.org/ramen-newdals/32/3453_2.png) [@ramen-newdals](https://discourse.itk.org/u/ramen-newdals)
#### Post date: [May 8, 2023, 1:52pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/5 "2023-05-08T13:52:54Z")

</div>

Hello Thanks for the reply:  
**Compilers:**  
C++ --\>(GCC) 13.1.1 20230429  
C → (GCC) 13.1.1 20230429  
**Error**

```auto
ITK/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h:41:14: error: use of enum ‘Algorithm’ without previous declaration
   41 | enum class Algorithm : uint8_t
      | ^ ~~~~~~~~
ITK/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h:41:26: error: ‘uint8_t’ was not declared in this scope
   41 | enum class Algorithm : uint8_t
      | ^ ~~~~~~
ITK/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h:23:1: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
   22 | #include "ITKMathematicalMorphologyExport.h"
  +++ |+#include <cstdint>
   23 | 
ITK/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h:42:3: error: default member initializer for unnamed bit-field
   42 | {
      | ^
ITK/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h:52:107: error: ‘Algorithm’ in ‘class itk::MathematicalMorphologyEnums’ does not name a type
   52 | operator<<(std::ostream & out, const MathematicalMorphologyEnums::Algorithm value);
      | ^ ~~~~~~~~
ITK/Modules/Filtering/MathematicalMorphology/src/itkMathematicalMorphologyEnums.cxx:25:67: error: ‘Algorithm’ in ‘class itk::MathematicalMorphologyEnums’ does not name a type
   25 | operator<<(std::ostream & out, const MathematicalMorphologyEnums::Algorithm value)
      | ^ ~~~~~~~~
ITK/Modules/Filtering/MathematicalMorphology/src/itkMathematicalMorphologyEnums.cxx: In lambda function:
ITK/Modules/Filtering/MathematicalMorphology/src/itkMathematicalMorphologyEnums.cxx:30:41: error: ‘itk::MathematicalMorphologyEnums::Algorithm’ has not been declared
   30 | case MathematicalMorphologyEnums::Algorithm::BASIC:
      | ^ ~~~~~~~~
ITK/Modules/Filtering/MathematicalMorphology/src/itkMathematicalMorphologyEnums.cxx:32:41: error: ‘itk::MathematicalMorphologyEnums::Algorithm’ has not been declared
   32 | case MathematicalMorphologyEnums::Algorithm::HISTO:
      | ^ ~~~~~~~~
ITK/Modules/Filtering/MathematicalMorphology/src/itkMathematicalMorphologyEnums.cxx:34:41: error: ‘itk::MathematicalMorphologyEnums::Algorithm’ has not been declared
   34 | case MathematicalMorphologyEnums::Algorithm::ANCHOR:
      | ^ ~~~~~~~~
ITK/Modules/Filtering/MathematicalMorphology/src/itkMathematicalMorphologyEnums.cxx:36:41: error: ‘itk::MathematicalMorphologyEnums::Algorithm’ has not been declared
   36 | case MathematicalMorphologyEnums::Algorithm::VHGW:
      | ^ ~~~~~~~~
make[2]: *** [Modules/Filtering/MathematicalMorphology/src/CMakeFiles/ITKMathematicalMorphology.dir/build.make:76: Modules/Filtering/MathematicalMorphology/src/CMakeFiles/ITKMathematicalMorphology.dir/itkMathematicalMorphologyEnums.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:16833: Modules/Filtering/MathematicalMorphology/src/CMakeFiles/ITKMathematicalMorphology.dir/all] Error 2

```

---

<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 8, 2023, 1:58pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/6 "2023-05-08T13:58:47Z")

</div>

If you change line 41 to read `enum class Algorithm : std::uint8_t`, does that fix it?

GCC 13.1 is very new, I guess no one tested compiling ITK with it before.

---

<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 8, 2023, 2:00pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/7 "2023-05-08T14:00:16Z")

</div>

I assume this will not be the only error. @blowekamp @hjmjohnson do you have time to make ITK compile with GCC 13?

---

<div class="post-metadata">

### Author: ![ramen-newdals](https://discourse.itk.org/user_avatar/discourse.itk.org/ramen-newdals/32/3453_2.png) [@ramen-newdals](https://discourse.itk.org/u/ramen-newdals)
#### Post date: [May 8, 2023, 2:13pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/8 "2023-05-08T14:13:30Z")

</div>

To clarify to you mean modify line 41 to be:

```auto
}(enum class Algorithinm : std::uint8_t);

```

or

```auto
(enum class Algorithinm : std::uint8_t);

```

---

<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 8, 2023, 2:17pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/9 "2023-05-08T14:17:18Z")

</div>

Line 41:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/79a2823dcd51489a926beb98edb89df60b629c39/Modules/Filtering/MathematicalMorphology/include/itkMathematicalMorphologyEnums.h#L41>

does not have any parentheses or braces for me.

---

<div class="post-metadata">

### Author: ![ramen-newdals](https://discourse.itk.org/user_avatar/discourse.itk.org/ramen-newdals/32/3453_2.png) [@ramen-newdals](https://discourse.itk.org/u/ramen-newdals)
#### Post date: [May 8, 2023, 2:35pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/10 "2023-05-08T14:35:04Z")

</div>

My apologies I was editing the .cxx not the .h.

Making that change as well as adding

```auto
#include <cstdint>

```

fixed the problem for me, no other build errors.

I can submit a PR if the devs want thank you for your help and fast replies!

---

<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 8, 2023, 2:43pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/11 "2023-05-08T14:43:43Z")

</div>

Please do submit the PR. See [contribution guidelines](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md).

---

<div class="post-metadata">

### Author: ![ramen-newdals](https://discourse.itk.org/user_avatar/discourse.itk.org/ramen-newdals/32/3453_2.png) [@ramen-newdals](https://discourse.itk.org/u/ramen-newdals)
#### Post date: [May 8, 2023, 3:44pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/12 "2023-05-08T15:44:26Z")

</div>

Created waiting for approval, I tried to tag you in the request, but I could not find your github username please share if possible.

---

<div class="post-metadata">

### Author: ![hubutui](https://discourse.itk.org/user_avatar/discourse.itk.org/hubutui/32/716_2.png) [@hubutui](https://discourse.itk.org/u/hubutui)
#### Post date: [May 9, 2023, 6:37am UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/13 "2023-05-09T06:37:26Z")

</div>

Hi, I also compile itk from the source with gcc 13, and got `/usr/include/stdlib.h:252:4: error: unknown type name '_Float32x'` errors. here is the complete build log.  
[log.txt](https://discourse.itk.org/uploads/short-url/kcWZ5iKJmkXofZvLMga5bNPhqas.txt) (266.9 KB)  
The first error occurs at line 3210.  
I can confirm that this [pr](https://github.com/InsightSoftwareConsortium/ITK/pull/4041) is included.

---

<div class="post-metadata">

### Author: ![hubutui](https://discourse.itk.org/user_avatar/discourse.itk.org/hubutui/32/716_2.png) [@hubutui](https://discourse.itk.org/u/hubutui)
#### Post date: [May 9, 2023, 7:30am UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/14 "2023-05-09T07:30:29Z")

</div>

I found a thread that user encounter similar error with gcc 13, but they’re using cuda. [Strange errors after system gcc upgraded to 13.1.1 - #3 by Sanhu\_Li - nvc, nvc++ and nvfortran - NVIDIA Developer Forums](https://forums.developer.nvidia.com/t/strange-errors-after-system-gcc-upgraded-to-13-1-1/252441/3)

---

<div class="post-metadata">

### Author: ![ramen-newdals](https://discourse.itk.org/user_avatar/discourse.itk.org/ramen-newdals/32/3453_2.png) [@ramen-newdals](https://discourse.itk.org/u/ramen-newdals)
#### Post date: [May 9, 2023, 2:29pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/15 "2023-05-09T14:29:47Z")

</div>

You are building ITK from a package manager (looks like pacman), clone the git repository yourself and try to install as I can not confirm that the build procedure for ITK from pacman works.

---

<div class="post-metadata">

### Author: ![hubutui](https://discourse.itk.org/user_avatar/discourse.itk.org/hubutui/32/716_2.png) [@hubutui](https://discourse.itk.org/u/hubutui)
#### Post date: [May 10, 2023, 7:16am UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/16 "2023-05-10T07:16:56Z")

</div>

Ok, I could build it with gcc 12.

---

<div class="post-metadata">

### Author: ![ramen-newdals](https://discourse.itk.org/user_avatar/discourse.itk.org/ramen-newdals/32/3453_2.png) [@ramen-newdals](https://discourse.itk.org/u/ramen-newdals)
#### Post date: [May 10, 2023, 3:36pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/17 "2023-05-10T15:36:21Z")

</div>

Was this with you cloning the github repo or from your package manager?

---

<div class="post-metadata">

### Author: ![Wayne\_Marshall](https://discourse.itk.org/user_avatar/discourse.itk.org/wayne_marshall/32/3500_2.png) [@Wayne\_Marshall](https://discourse.itk.org/u/Wayne_Marshall)
#### Post date: [June 17, 2023, 5:51pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/18 "2023-06-17T17:51:19Z")

</div>

To build with GCC 13 just patch 🙂  
— InsightToolkit-4.13.2.orig/Modules/ThirdParty/VNL/src/vxl/vcl/vcl\_compiler.h  
+++ InsightToolkit-4.13.2/Modules/ThirdParty/VNL/src/vxl/vcl/vcl\_compiler.h

+# elif ( **GNUC** ==13)  
+# define VCL\_GCC\_13  
+# if ( **GNUC\_MINOR** \> 2 )  
+# define VCL\_GCC\_133  
+# elif ( **GNUC\_MINOR** \> 1 )  
+# define VCL\_GCC\_132  
+# elif ( **GNUC\_MINOR** \> 0 )  
+# define VCL\_GCC\_131  
+# else  
+# define VCL\_GCC\_130  
+# endif

# else

# error “Dunno about this gcc”

# endif

---

<div class="post-metadata">

### Author: ![Wayne\_Marshall](https://discourse.itk.org/user_avatar/discourse.itk.org/wayne_marshall/32/3500_2.png) [@Wayne\_Marshall](https://discourse.itk.org/u/Wayne_Marshall)
#### Post date: [June 17, 2023, 5:56pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/19 "2023-06-17T17:56:54Z")

</div>

To compile with GCC13 and Higher I just add New compiler versions 🙂

patch -p1 \<\<‘endpatch’  
— InsightToolkit-4.13.2.orig/Modules/ThirdParty/VNL/src/vxl/vcl/vcl\_compiler.h  
+++ InsightToolkit-4.13.2/Modules/ThirdParty/VNL/src/vxl/vcl/vcl\_compiler.h  
@@ -97,6 +97,50 @@

# else

# define VCL\_GCC\_80

# endif

+# elif ( **GNUC** ==9)  
+# define VCL\_GCC\_9  
+# if ( **GNUC\_MINOR** \> 2 )  
+# define VCL\_GCC\_93  
+# elif ( **GNUC\_MINOR** \> 1 )  
+# define VCL\_GCC\_92  
+# elif ( **GNUC\_MINOR** \> 0 )  
+# define VCL\_GCC\_91  
+# else  
+# define VCL\_GCC\_90  
+# endif  
+# elif ( **GNUC** ==10)  
+# define VCL\_GCC\_10  
+# if ( **GNUC\_MINOR** \> 2 )  
+# define VCL\_GCC\_103  
+# elif ( **GNUC\_MINOR** \> 1 )  
+# define VCL\_GCC\_102  
+# elif ( **GNUC\_MINOR** \> 0 )  
+# define VCL\_GCC\_101  
+# else  
+# define VCL\_GCC\_100  
+# endif  
+# elif ( **GNUC** ==11)  
+# define VCL\_GCC\_11  
+# if ( **GNUC\_MINOR** \> 2 )  
+# define VCL\_GCC\_113  
+# elif ( **GNUC\_MINOR** \> 1 )  
+# define VCL\_GCC\_112  
+# elif ( **GNUC\_MINOR** \> 0 )  
+# define VCL\_GCC\_111  
+# else  
+# define VCL\_GCC\_110  
+# endif  
+# elif ( **GNUC** ==12)  
+# define VCL\_GCC\_12  
+# if ( **GNUC\_MINOR** \> 2 )  
+# define VCL\_GCC\_123  
+# elif ( **GNUC\_MINOR** \> 1 )  
+# define VCL\_GCC\_122  
+# elif ( **GNUC\_MINOR** \> 0 )  
+# define VCL\_GCC\_121  
+# else  
+# define VCL\_GCC\_120  
+# endif  
+# elif ( **GNUC** ==13)  
+# define VCL\_GCC\_13  
+# if ( **GNUC\_MINOR** \> 2 )  
+# define VCL\_GCC\_133  
+# elif ( **GNUC\_MINOR** \> 1 )  
+# define VCL\_GCC\_132  
+# elif ( **GNUC\_MINOR** \> 0 )  
+# define VCL\_GCC\_131  
+# else  
+# define VCL\_GCC\_130  
+# endif

# else

# error “Dunno about this gcc”

# endif

endpatch

---

<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: [June 19, 2023, 1:10pm UTC](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927/20 "2023-06-19T13:10:30Z")

</div>

This is useful information @Wayne_Marshall. Could you turn it into a PR as per [contribution guidelines](https://github.com/InsightSoftwareConsortium/ITK/blob/master/CONTRIBUTING.md)?

[Next page](https://discourse.itk.org/t/building-itk-error-with-algorithim-module/5927.md?page=2)
