Trouble debugging HighlightPickedActor example

I was able to successfully build and install vtk on Visual Studio 2019 thanks to various resources:

Having generates the VS solution and DLLs in an install directory, I then tried to get a simple example working using:

I was able to build the example HighlightPickedActor successfully, and now get a render window with the correct visuals when I run the example under the release configuration.

However when I run it in the debug configuration and try to set a breakpoint in line 84 of HighlightPickedActor.cxx I get an error thrown by line 82:

Exception thrown at 0x00007FFAD2CDAB10 (vtkCommonColor-9.0.dll) in HighlightPickedActor.exe: 0xC0000005: Access violation reading location 0x000000897B900000. occurred

Why does the example work under the Release configuration but not under the Debug configuration? Must I build the example for each configuration before I am able to Debug it? What does the ALL_BUILD project do?

It is not possible to tell what is wrong, but one possibility is that you mixed debug and release mode DLLs and executables. For example, if you try to use VTK DLL that is built in release mode with an executable built in debug mode then the application is expected to crash.

I got exactly the same problem, and as you pointed out that I used the release version vtk to build my debug version sample code. Thanks a lot Andras!

1 Like