# Error in Writing to a VTU image

**URL:** https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361
**Category:** Support
**Created:** [October 6, 2020, 11:53am UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361 "2020-10-06T11:53:59Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [October 6, 2020, 11:53am UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/1 "2020-10-06T11:53:59Z")

</div>

Dear All,

I am trying to write to a VTU file from one example and it is giving the errors of the image.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/8/81bd7d9683ba3e69da88a99d3e1f119509b22ef2.png)

Can you please inform me how to initialize such variables?

Thanks,

Luis Gonçalves

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [October 6, 2020, 11:58am UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/2 "2020-10-06T11:58:56Z")

</div>

> **[Image of an exception](https://idownvotedbecau.se/imageofanexception/)**

Please post your code as well as the text of the exception.

---

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [October 6, 2020, 9:57pm UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/3 "2020-10-06T21:57:23Z")

</div>

I will back again on this later. I have now to prioritize another tasks.

The errors appear with #include \<vtkTetra.h\>

---

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [October 9, 2020, 10:11am UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/4 "2020-10-09T10:11:04Z")

</div>

Good morning,

I isolated the code and created a new project. Seems that is deprecated features. For information it is compile time error.

See the errors:

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

See the program:  
[Program to WriteVTU](https://www.luisgo.pro/down/ExampleVTK.cpp)

To replicate the problem:

[Project WriteVTU](https://www.luisgo.pro/down/ExampleVTK.zip)

Are there some more recent program that does what I want?

Can you provide some recent example code to write to a VTU file?

Thanks,

Luis Gonçalves

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [October 12, 2020, 8:11am UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/5 "2020-10-12T08:11:39Z")

</div>

Do not post image of exception, post the text of the exception using Copy/Paste feature.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [October 12, 2020, 8:12am UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/6 "2020-10-12T08:12:13Z")

</div>

In any case, juste enable legacy in your VTK compilation to fix the issue.

---

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [October 12, 2020, 4:40pm UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/7 "2020-10-12T16:40:42Z")

</div>

Sorry for the image. I think you do not like but I think it is more clear.  
I put the option in the image “WANT” (see cmake-gui window). If I put “YES” the VTK package compilation gives error.  
But my program still giving the same compilation error if I compile VTK with “WANT”.

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

Thanks in Advance for the possible help.

Luis Gonçalves

---

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [October 23, 2020, 3:58pm UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/8 "2020-10-23T15:58:14Z")

</div>

There is not solution for this question? I provided the source code and even the Visual 2017 project. What you need more?

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [October 23, 2020, 4:06pm UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/9 "2020-10-23T16:06:32Z")

</div>

That is not the right legacy option. Probably you’ll need VTK\_LEGACY\_REMOVE=OFF and VTK\_LEGACY\_SILENT=ON

---

<div class="post-metadata">

### Author: ![Luis\_Carlos\_Carneiro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/luis_carlos_carneiro/32/1360_2.png) [@Luis\_Carlos\_Carneiro](https://discourse.vtk.org/u/Luis_Carlos_Carneiro)
#### Post date: [October 23, 2020, 5:15pm UTC](https://discourse.vtk.org/t/error-in-writing-to-a-vtu-image/4361/10 "2020-10-23T17:15:36Z")

</div>

Sorry, It did not worked. See the result of the compilation. The VTK\_LEGACY\_REMOVE was already off. VTK\_LEGACY\_SILENT was toggled to ON.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/0/07dc4c4b387ba995a836f09f119aeb60d6ac0cb8.png)
