Can't build VTK examples

I’m new to this forum, and in ‘learning’ mode… :slight_smile:

I have built VTK, version 9.0.3 successfully using Visual Studio 2019 x64. I managed to build one example manually and can verify ‘it works’.

Now I would like to build all examples from here:

However, when firing up the cmake gui and using default settings, I get the following error:

Any clues on how to get past that one? I’m reading information regarding the examples, that ‘the examples are now tests’. I assume(?) this relates to the examples with in the vtk repository?

Best Regards,

Avoid building the exampe repository. You are supposed to go on the example website and try the examples you are interested into.

As @mwestphal, said the best approach would be to initially get familiar with building selected examples from the web site. This will let you iron out path issues etc. in your system. Once that is done, you can move on to building all the examples.

FYI: GenericClip needs VTK to be built with Testing ON.

Thanks for you reply(ies).

So the above error means that VTK need to be built with ‘Testing, Tests’ being ON? I’ll look for the setting ‘TESTING_GENERIC_BRIDGE’, and see if I can turn that ON…

By the way, as mentioned, I am compiling example by example, but its time consuming and pretty messy.

I would say, for a beginner, that its desirable to be able to build all examples in one go, allowing a user to just select from the project manager in VS which one to debug and learn from. Perhaps there should be a disclaimer to not build the examples, for a beginner, in case the CMake files are known to be broken?

You usually only need a few examples so it is best to search the web site.

However …
Rebuild VTK with VTK_BUILD_TESTING set to WANT.

If this fails then there are issues in your setup.

I regularly build using ninja for Linux and ninja and VS for Windows usually weekly and have no issues.

Thanks for the information that VTK need to be built with TESTING ON.

So, I recompiled VTK setting that flag to WANT, and that allowed me to build all the examples.

I can run most of them from within Visual studio, in Debug mode. See image:

However, which is weird, in any example that are setting or using a color, using the vtkNamedColors class, exceptions are thrown.

So a line like this:


causes an exception

When creating an example ‘manually’ this problem (exception) don’t happen.

This may mean that there are some settings in the vtk examples cmake setup that are overriding ‘something’, or missing setting up/ loading(?) modules, causing the problem.

I have checked, using the ‘modules’ view that the proper DLL’s seem to be loaded OK.

You probably have a path problem. I just rebuilt the examples and ran Axes, no issues at all within Visual Studio.