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

**URL:** https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359
**Category:** Support
**Created:** [October 6, 2020, 11:17am UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359 "2020-10-06T11:17:04Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [October 6, 2020, 11:17am UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359/1 "2020-10-06T11:17:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [October 6, 2020, 1:04pm UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359/2 "2020-10-06T13:04:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [October 6, 2020, 1:20pm UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359/3 "2020-10-06T13:20:36Z")

</div>

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
```

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [October 6, 2020, 2:34pm UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359/4 "2020-10-06T14:34:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [October 6, 2020, 2:44pm UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359/5 "2020-10-06T14:44:05Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [October 6, 2020, 2:59pm UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359/6 "2020-10-06T14:59:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [October 6, 2020, 2:59pm UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359/7 "2020-10-06T14:59:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [October 7, 2020, 7:48am UTC](https://discourse.vtk.org/t/vtk-9-0-hangs-with-visual-c-2015-hanging-in-building-code/4359/9 "2020-10-07T07:48:33Z")

</div>

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
