-
-
Notifications
You must be signed in to change notification settings - Fork 664
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
missing implementation of std::ostream & operator<<(std::ostream & out, const RecursiveGaussianImageFilterEnums::GaussianOrder value) #1890
Comments
Is this simply trying to compile ITK or is this an error in your project when you try using ITK? Which CMake configuration options are you using? |
ITK compiles fine, the problem occurs in a project of mine, under Visual Studio 2019 (x64 build)
|
The content of (the relevant part of) your project's |
Just checked, the bug is still present in current master (I used https://itk.org/Wiki/ITK/Using_ITK_Without_CMake and have to manually call itk::MetaImageIOFactory::RegisterOneFactory(), but it is fine) |
You might want to regenerate your copy-pasted list of libraries using the most recent build of an example project which does use CMake. |
Thanks for the hint, but I won't have time to do that in a near future, so I won't have feedback on that point. I forgot to mention that there was no problem with ITK 5.0.1, that's why I am confident with the good shape of my project. The idea of a change in strongly typed enumerations might be a clue. |
My fault : I misinterpreted the whole thing. |
I just hit this same issue when upgrading from 5.0.1 to 5.1, only in my circumstance, I'm using # CMakeLists.txt
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(link-fails)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
add_executable(link-fails main.cpp)
target_link_libraries(link-fails
ITKCommon
ITKTransform
ITKOptimizers
) // main.cpp
#include <itkImage.h>
#include <itkMattesMutualInformationImageToImageMetric.h>
int main() {
using Image = itk::Image<uint8_t, 2>;
using Metric = itk::MattesMutualInformationImageToImageMetric<Image, Image>;
auto metric = Metric::New();
} This compiles fine against 5.0.1, but fails with 5.1 during linking:
I can "fix" this by linking against if(TARGET ITKSmoothing)
target_link_libraries(link-fails ITKSmoothing)
endif() But I feel like this shouldn't be necessary and that there's a bug here somewhere. If Mattes now needs new symbols, then shouldn't one of the libraries I'm linking against provide that through CMake? Isn't that what CMake is for? Or is this all complicated because the Mattes class is templated and INTERFACE targets weren't a thing when the ITK build system was written? Or maybe my 5.0.1 build is the bug and it should have and need ITKSmoothing, but doesn't? |
Your cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(link-fails)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
add_executable(link-fails main.cpp)
target_link_libraries(link-fails ${ITK_LIBRARIES}) and if you want minimal number of linked libraries at the expense of hassle, then this: cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(link-fails)
find_package(ITK REQUIRED COMPONENTS
ITKCommon
ITKTransform
ITKOptimizers
ITKSmoothing
)
include(${ITK_USE_FILE})
add_executable(link-fails main.cpp)
target_link_libraries(link-fails ${ITK_LIBRARIES}) |
Thanks @dzenanz. I've had issues with portability of my project when I link against the full list of libraries, so I've tried to keep my dependencies minimal overall. Is there a better way to figure out the minimal dependencies for a class than seeing if the build fails and adding in libraries until it doesn't? Also, any idea what I didn't need |
The way is to ask for all the modules whose classes you are directly using. You can find that out from the docs. For example, gaussian filter has in the header of the page written "Module ITKSmoothing". Each class has an indication of their module. If your code is non-trivial, you can use the script to determine that. |
Ahh! It being previously header-only makes perfect sense. And that script is excellent. I'll give it a try. Thanks! |
ITK 5.1
It seems that
std::ostream & operator<<(std::ostream & out, const RecursiveGaussianImageFilterEnums::GaussianOrder value)
is not implemented and I have link error when using itkMultiResolutionPDEDeformableRegistration
adding
in any compilation unit will fix it (until a real implementation is given)
The text was updated successfully, but these errors were encountered: