InsightSoftwareConsortium / ITKIsotropicWavelets

External Module for ITK, implementing Isotropic Wavelets and Riesz Filter for multiscale phase analysis.
Apache License 2.0
13 stars 11 forks source link

Warnings in MacOS (Wundefined-var-template) #120

Closed phcerdan closed 5 years ago

phcerdan commented 5 years ago

Only in clang.

https://open.cdash.org/viewBuildError.php?type=1&buildid=5772807

Modules/Core/Common/include/itkNumericTraits.h:1083:36: warning: instantiation of variable 'itk::NumericTraits<std::__1::complex<double> >::Zero' required here, but no definition is available [-Wundefined-var-template]
  static Self ZeroValue() { return Zero; }

Modules/Core/Common/include/itkNumericTraits.h:1083:36: note: add an explicit instantiation declaration to suppress this warning if 'itk::NumericTraits<std::__1::complex<double> >::Zero' is explicitly instantiated in another translation unit

  static Self ZeroValue() { return Zero; }

This is related to the numeric traits of complex types:

https://github.com/InsightSoftwareConsortium/ITK/blob/c06eb6859b561ae1fb7aca8149e46769cbfe6e99/Modules/Core/Common/include/itkNumericTraits.h#L1062-L1089

thewtex commented 5 years ago

This can safely be suppressed with -Wno-undefined-var-template:

https://github.com/InsightSoftwareConsortium/ITK/blob/a5a1d71a3771f283e026a39702cae627800fe96a/CMake/ITKSetStandardCompilerFlags.cmake#L125

https://github.com/InsightSoftwareConsortium/ITK/commit/f72c925170f4b5057eb9c3212754edac995b3d62

phcerdan commented 5 years ago

TODO: Add that compiler flag in CMakeLists.txt

Note: That flag is added in ITK, but because we are compiling this externally, we need to set it here too.