# Exception thrown calling vtkColor3d GetColor3D in ReadOBJ example

**URL:** https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087
**Category:** Support
**Created:** [November 5, 2021, 4:09pm UTC](https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087 "2021-11-05T16:09:21Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![tiberius](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@tiberius](https://discourse.vtk.org/u/tiberius)
#### Post date: [November 5, 2021, 4:09pm UTC](https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087/1 "2021-11-05T16:09:21Z")

</div>

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](https://kitware.github.io/vtk-examples/site/Cxx/IO/ReadOBJ/), configured, and built it. It throws an exception at line 31 while calling

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

```

The exception

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

---

<div class="post-metadata">

### Author: ![tiberius](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@tiberius](https://discourse.vtk.org/u/tiberius)
#### Post date: [November 6, 2021, 6:56pm UTC](https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087/2 "2021-11-06T18:56:14Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Parisa\_Rabbani](https://discourse.vtk.org/user_avatar/discourse.vtk.org/parisa_rabbani/32/4295_2.png) [@Parisa\_Rabbani](https://discourse.vtk.org/u/Parisa_Rabbani)
#### Post date: [May 9, 2023, 6:16pm UTC](https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087/3 "2023-05-09T18:16:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tiberius](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@tiberius](https://discourse.vtk.org/u/tiberius)
#### Post date: [May 9, 2023, 6:18pm UTC](https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087/4 "2023-05-09T18:18:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![xinlong](https://discourse.vtk.org/user_avatar/discourse.vtk.org/xinlong/32/7670_2.png) [@xinlong](https://discourse.vtk.org/u/xinlong)
#### Post date: [September 2, 2023, 12:02am UTC](https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087/5 "2023-09-02T00:02:50Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [September 2, 2023, 2:46am UTC](https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087/6 "2023-09-02T02:46:10Z")

</div>

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.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/4bc1ba3e4cbd42c3e6ec2596d2efcdd406765a20.png)

---

<div class="post-metadata">

### Author: ![aranudlejeune](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@aranudlejeune](https://discourse.vtk.org/u/aranudlejeune)
#### Post date: [May 6, 2025, 2:20pm UTC](https://discourse.vtk.org/t/exception-thrown-calling-vtkcolor3d-getcolor3d-in-readobj-example/7087/7 "2025-05-06T14:20:42Z")

</div>

Having the same issue.  
Solved it by ensuring that the example is linked with the same configuration of librairy (“Release exe” with “Release dll” or "Debug exe with Debug dll))
