vtk 9.0 hangs with visual c++2015 hanging in building code

Hello,

I have a doubt to upgrade my project to vtk 9.0. It was working all well with vtk 8.11. Then I compiled all in vtk 9 and itk 4 again. The build is correct and I changed the cmake of my project as:

find_package(VTK COMPONENTS REQUIRED
CommonCore
CommonDataModel
FiltersFlowPaths
GUISupportQt
InteractionImage
ImagingStencil
ImagingMorphological
IOGeometry
IOImage
IOImport
IOLegacy
IOXML
RenderingCore #${VTK_RENDERING_BACKEND}
RenderingVolumeOpenGL2
InteractionWidgets
NO_MODULE)

vtk_module_autoinit(
TARGETS VtkMgr
MODULES ${VTK_LIBRARIES}
)

to make it compatible with vtk 9.0 and visual c++ hangs forever. If I restore the last vtk it works again

Someone has the same problem, If I insist sometimes it ends compilation but maybe after trying 100 times only once it builds it.

I cannot understand the reason. I do not have any error in cmake.

Thanks

Is there any output before it hangs? Is it during the build or during the configure that it hangs?

Thank you for answering. It is when I am building the code. I think the incompatibilty comes with qt
because if I remove in
add_library of the cmake the class related to qt it builds it. But it is weird that sometimes it builds it and sometimes it doesn’t so I imagine is certain incompatibility with qt. In lower versions of vtk it works perfectly. I am trying to guess if the problems comes from the deprecated warnings that are referred to qt. So I wonder if someone had the same problem

#include <QtWidgets>

namespace x {
namespace y {
namespace z {

class Volume : public QObject {
  Q_OBJECT

public:
virtual ~Volume() = default;
void loadDicomData(std::string);
   virtual void loadVolumeDicom(std::string folder) =
   0;
std::string folder_;
bool loaded_dicom_ = false;
bool isSeriesWithSubdirDicomInside_ = false;
bool Error_In_dicom_file_ = false;

 public slots:
    void load();

  signals:
    void finished();
    void errorDCM(const QString& err_txt = "");

 };
}  // namespace x
}  // namespace y
}  // namespace z

The problem is this Q_OBJECT that has some incompability with vtk 9.0. But without it, It fails… Too weird…

If you take VTK out of the equation, does it work? This doesn’t use any VTK code, so it should.

Note that you should use triple backticks to quote code (you can see the preview before you post; your include is gone because it’s treated as invalid HTML).

Thanks for answering. Yes it uses vtk for loading the dicom, this class is a dicom loader and a volume mapper. If I change the path in cmake with the version 8 it works. I indented the code. It is because something new of vtk is intefering with this Q_Object but I cannot see now what it is. I will let you know if I find it.

VTK and Q_OBJECT are used in many places, so that is unlikely. Do you have a full example I could look at?

I have removed the signals as they were not extremelly necessary in here and It works now. But just for curiosity I wonder why it happens in vtk 9.0. I imagine because it is a subproject and does not go to executable project and I must especify something else in vtk 9.0. If I find it out I let you know. By now, it works like this. Thanks