[vtk-developers] Shared builds of VTK and debugging QVTKWidget using Visual Studio

Andrew Maclean andrew.amaclean at gmail.com
Thu Aug 7 21:52:09 EDT 2008


Assuming that you have built a shared build of VTK and you may or may
not have a set it up such that there is a path to the release version
of VTK in your PATH statement.

Then if you debug a project that is using QVTKWidget, you will come
across a problem in that if you are debugging a debug version; the
application depends upon the debug version of QVTK.dll which will
depend upon QtGui4.dll (among others) and load it. But, because the
release version of QVTK.dll is in the path, QtGiu4.dll will also be
loaded preventing the application from running. You will get a
"QWidget: Must construct a QApplication before a QPaintDevice"
message.

The solution to this problem is to set the path to the correct builld
of VTK on the "Debugging" properties of your project. Right click on
your project, bring up the properties dialog, and select "Debugging"
from the list on the left. There should be an "Environment" line. You
can add variables here using key=value pairs.
For example, add the following line:
PATH=<Path To VTK>\Kitware\build\VTK\bin\$(OutDir);%PATH%
You can then add the same line to other configurations, by selecting
them from the top left drop down box labelled Configuration.

$(OutDir) will be set by Visual Studio to either Debug or Release,
depending upon what configuration you have selected. Make sure that
;%PATH% is appended so that Qt and other files can be appended to the
PATH statement.

Many thanks to Clinton Stimpson for his assistance, see the thread:
QVTKWidgetPlugin debug/release versions on Windows.

If anyone wants to put this in the Wiki - I would appreciate it if you
could do this on my behalf, I do not have write access to it.

Andrew

-- 
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney 2006 NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________



More information about the vtk-developers mailing list