Build error with g++ 13.2

Just tried building ITK 5.4rc1 with g++ 13.2.1 on Fedora 39 (I erroneously reported clang 17 before, which I thought the build was using, but the compiler didn’t get set properly, the build was actually running with g++), I got this build error:

FAILED: Modules/Core/GPUFiniteDifference/src/CMakeFiles/ITKGPUFiniteDifference.dir/itkGPUFiniteDifferenceFilterEnum.cxx.o 
/usr/bin/c++ -DITKGPUFiniteDifference_EXPORTS -I/build/itk/bin-5.4rc01/Modules/ThirdParty/Eigen3/src -I/build/itk/bin-5.4rc01/Modules/ThirdParty/KWSys/src -I/build/itk/src-5.4rc01/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -I/build/itk/src-5.4rc01/Modules/ThirdParty/VNL/src/vxl/vcl -I/build/itk/src-5.4rc01/Modules/ThirdParty/VNL/src/vxl/core -I/build/itk/bin-5.4rc01/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -I/build/itk/bin-5.4rc01/Modules/ThirdParty/VNL/src/vxl/vcl -I/build/itk/bin-5.4rc01/Modules/ThirdParty/VNL/src/vxl/core -I/build/itk/bin-5.4rc01/Modules/Core/Common -I/build/itk/src-5.4rc01/Modules/Core/Common/include -I/build/itk/src-5.4rc01/Modules/Core/FiniteDifference/include -I/build/itk/src-5.4rc01/Modules/Core/GPUCommon/include -I/build/OpenCL/install/include -I/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/include -I/build/itk/src-5.4rc01/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo -I/build/itk/src-5.4rc01/Modules/ThirdParty/VNL/src/vxl/core/vnl -I/build/itk/bin-5.4rc01/Modules/ThirdParty/VNL/src/vxl/core/vnl -isystem /build/itk/src-5.4rc01/Modules/ThirdParty/Eigen3/src/itkeigen/.. -mtune=generic -march=corei7 -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wctad-maybe-unsupported -Wstrict-null-sentinel  -fno-sized-deallocation -msse2 -O3 -DNDEBUG -std=c++17 -fPIC -MD -MT Modules/Core/GPUFiniteDifference/src/CMakeFiles/ITKGPUFiniteDifference.dir/itkGPUFiniteDifferenceFilterEnum.cxx.o -MF Modules/Core/GPUFiniteDifference/src/CMakeFiles/ITKGPUFiniteDifference.dir/itkGPUFiniteDifferenceFilterEnum.cxx.o.d -o Modules/Core/GPUFiniteDifference/src/CMakeFiles/ITKGPUFiniteDifference.dir/itkGPUFiniteDifferenceFilterEnum.cxx.o -c /build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/src/itkGPUFiniteDifferenceFilterEnum.cxx
In file included from /build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/src/itkGPUFiniteDifferenceFilterEnum.cxx:18:
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFilterEnum.h:30:6: warning: elaborated-type-specifier for a scoped enum must not use the ‘class’ keyword
   30 | enum class GPUFiniteDifferenceFilterEnum : uint8_t
      | ~~~~ ^~~~~
      |      -----
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFilterEnum.h:30:42: error: found ‘:’ in nested-name-specifier, expected ‘::’
   30 | enum class GPUFiniteDifferenceFilterEnum : uint8_t
      |                                          ^
      |                                          ::
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFilterEnum.h:30:12: error: ‘GPUFiniteDifferenceFilterEnum’ has not been declared
   30 | enum class GPUFiniteDifferenceFilterEnum : uint8_t
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFilterEnum.h:31:1: error: expected unqualified-id before ‘{’ token
   31 | {
      | ^
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/include/itkGPUFiniteDifferenceFilterEnum.h:37:75: error: ‘GPUFiniteDifferenceFilterEnum’ does not name a type; did you mean ‘itkGPUFiniteDifferenceFilterEnum_h’?
   37 |                                      operator<<(std::ostream & out, const GPUFiniteDifferenceFilterEnum value);
      |                                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                           itkGPUFiniteDifferenceFilterEnum_h
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/src/itkGPUFiniteDifferenceFilterEnum.cxx:23:38: error: ‘GPUFiniteDifferenceFilterEnum’ does not name a type; did you mean ‘itkGPUFiniteDifferenceFilterEnum_h’?
   23 | operator<<(std::ostream & out, const GPUFiniteDifferenceFilterEnum value)
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                      itkGPUFiniteDifferenceFilterEnum_h
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/src/itkGPUFiniteDifferenceFilterEnum.cxx: In lambda function:
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/src/itkGPUFiniteDifferenceFilterEnum.cxx:28:12: error: ‘GPUFiniteDifferenceFilterEnum’ has not been declared
   28 |       case GPUFiniteDifferenceFilterEnum::UNINITIALIZED:
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/itk/src-5.4rc01/Modules/Core/GPUFiniteDifference/src/itkGPUFiniteDifferenceFilterEnum.cxx:32:12: error: ‘GPUFiniteDifferenceFilterEnum’ has not been declared
   32 |       case GPUFiniteDifferenceFilterEnum::INITIALIZED:
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There’s an easy fix - the error goes away when inserting #include <cstdint>. I don’t have time at the moment to test if this is an issue in git master as well, so I don’t want to report a bug just yet. But considering that itkGPUFiniteDifferenceFilterEnum.h in master as well as the 5.4 branch do not contain #include <cstdint>, I assume it highly likely the error will happen there as well, and I wanted to report it somehow :wink: .

1 Like

It sounds like an easy fix. Could you submit a PR?

I think it should be:

#include "itkIntTypes.h"

In order to use uint8_t within the itk namespace.

My two cents, Niels

2 Likes

As originally planned I now also built using clang 17 and it has the same issue.

Done, see

Thanks for the hint, above pull request uses your proposed fix!

1 Like