Exception thrown calling vtkColor3d GetColor3D in ReadOBJ example

I am working with C++ in VS 2019 Community Edition.
I built and installed VTK-9.1.0.rc4. Afterwards, I wanted to try to verify using one of the examples. I grabbed the ReadOBJ example, configured, and built it. It throws an exception at line 31 while calling

vtkColor3d backgroundColor = colors->GetColor3d("SpringGreen");

The exception

Exception thrown at 0x00007FF8330DA190 (vtkCommonColor-9.1.dll) in ReadOBJ.exe: 0xC0000005: Access violation reading location 0x00000002CA1F0000.

I also tried the (apparently) older ImportOBJ example with the same results for the color “Silver”.

Has anyone seen this or have any suggestions for what might be happening?

In an attempt to troubleshoot this, I built the debug version of VTK and linked the ReadOBJ example against that. The example launches with no problems using the debug version of the libraries.

Any troubleshooting ideas out there?

Thanks!

Any luck with this? I’m facing the same issue.

Honestly, no. I wound up abandoning the idea of using VTK.

I am getting similar result when I do:
vtkNew colors;
double rgba[4]{ 0.0, 0.0, 0.0, 0.0 };
colors->GetColor(“Carrot”, rgba);
the code crashes with message: “Exception thrown at 0x00007FFBC30CA370 (vtkCommonColor-9.2.dll) in VolumeRendering.exe: 0xC0000005: Access violation reading location 0x000000DF04100000.”

any ideas about this?

Hello @xinlong

That is a very strange crash. I’ve tried your code and it appears to work. Can you test if it works in isolation like below? It may be a problem with your project build configuration or something overwrites memory before control reaches there.