Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
phcerdan opened this issue Mar 21, 2019 · 2 comments
Closed

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

phcerdan opened this issue Mar 21, 2019 · 2 comments

Comments

@phcerdan
Copy link
Collaborator

phcerdan commented Mar 21, 2019

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
Copy link
Member

thewtex commented Mar 21, 2019

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

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

InsightSoftwareConsortium/ITK@f72c925

@phcerdan
Copy link
Collaborator Author

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.

phcerdan added a commit to phcerdan/ITKIsotropicWavelets that referenced this issue Mar 27, 2019
Only needed when building the template externally with a clang compiler.

Hides the following spurious warnings:

```cpp
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; }
```

Fixes InsightSoftwareConsortium#120
phcerdan added a commit to phcerdan/ITKIsotropicWavelets that referenced this issue Mar 27, 2019
Only needed when building the template externally with a clang compiler.

Hides the following spurious warnings:

```cpp
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; }
```

Fixes InsightSoftwareConsortium#120
phcerdan added a commit to phcerdan/ITKIsotropicWavelets that referenced this issue Mar 28, 2019
Only needed when building the template externally with a clang compiler.

Hides the following spurious warnings:

```cpp
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; }
```

Fixes InsightSoftwareConsortium#120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants