[vtk-developers] QVTKWidgetPlugin debug/release versions on Windows

Andrew Maclean andrew.amaclean at gmail.com
Wed Aug 6 21:16:15 EDT 2008


Thankyou very much for all your help. Along the way you have also
clarified a lot of issues for me!

I'll set the path in VS9.

Andrew



On Thu, Aug 7, 2008 at 12:49 AM, Clinton Stimpson <clinton at elemtech.com> wrote:
>
> On Aug 5, 2008, at 11:48 PM, Andrew Maclean wrote:
>
>> You put me on the right "path" (almost). Several things were not correct.
>> 1) I had MikTex in the path and the QT??? dlls were loading from
>> there. So I put the Qt path first and the dlls were loaded from there.
>> 2) In the debug case both the release and debug versions of the Qt
>> dlls were being loaded because I have the VTK_BIN path in the PATH
>> variable set to the release version. Once I set this to the debug
>> version everything loaded Ok. Howerver ...
>
> Ahh you're also doing a shared build of VTK.
> A release build of the simpleview app depends on QVTK.dll, QtGui4.dll, and
> others...
> If you add the path to the debug QVTK.dll, things break, because the
> QVTK.dll will depend on QtGuid4.dll.
>
>>
>> ... the error now appears for the release version, once again QtGui4
>> and QtGui4d and QtCore and QtCored are being loaded. If I remove
>> VTK_BIN from the path then nothing loads.
>
> Same reason as above.
>
>>
>> 3) It seems to me that something triggers a load for both the debug
>> and release versions. Regarding Paraview, do the paraview guys use
>> static builds?
>
> ParaView requires a shared build for plugins to work.  But no one runs into
> it because all the dlls and executables go together in one directory, and
> nobody has to mess with their PATH variable.
>
> Your problems are related to the general issue of developing with multiple
> dlls with the same name on Windows.
> You were using VS 9?  It might have the same feature VS 8 has.  In the
> project properties, you can set environment variables when you run these
> applications from Visual Studio, instead of setting it globally for the
> whole system.  I'd set my path for the configuration to point to the
> respective vtk build directory.  Adding a debug postfix on the QVTK library
> would help, but you'd still be mixing up other VTK libraries.
>
> Clint
>
>
>>
>> I have attached CMakeCache.txt and a list of loaded dlls.
>>
>> Thanks
>>   Andrew
>>
>>
>> On Wed, Aug 6, 2008 at 1:54 PM, Clinton Stimpson <clinton at elemtech.com>
>> wrote:
>>>
>>> On Aug 5, 2008, at 4:33 PM, Andrew Maclean wrote:
>>>
>>>> I tried out the "d"postfix, and it sems to work Ok, but does not fix my
>>>> problem!
>>>>
>>>> This is probably me but there is something I don't understand.
>>>>
>>>> 1) I have copied the release version of QVTKWidgetPlugin.dll to
>>>> %QT_PATH%\plugins\designer and it appears Ok in designer. Note that
>>>> the debug build of this dll will not even register in designer.
>>>
>>>
>>>>
>>>> 2) I take SimpleView in the VTK/EXamples/QT and it builds OK - no
>>>> problems. I am building it in Visual Studio 9. CMake finds everything,
>>>> no errors, no warnings.
>>>>
>>>> When I run the release version in Visual Studio or from a command
>>>> prompt, it runs Ok.
>>>> However when I run the debug version either from Visual Studio or from
>>>> a command prompt, the instantiation fails at the line:
>>>>   vtkWidget = new QVTKWidget(centralWidget);
>>>> ui_uiSimpleView4.h
>>>> With a message: "QWidget: Must construct a QApplication before a
>>>> QPaintDevice"
>>>
>>>
>>>>
>>>> Why isn't QVTKWidget able to be used when building debug versions of
>>>> the executable?
>>>
>>> I think the error you're getting has come up on the vtk users list
>>> before.
>>> That error usually comes from the application depending on both the debug
>>> and release Qt libraries, either directly or indirectly.  You can get a
>>> hint
>>> of where this is coming from by looking at the output window when you
>>> debug
>>> the application, and if you're using shared Qt libs.  You might see
>>> QtGui4.dll and QtGui4d.dll loaded, which shouldn't happen.  Perhaps
>>> something is messed up in your CMakeCache.txt file.  You could send it to
>>> me
>>> if you want me to have a look.  Its interesting that you'd get this, and
>>> none of the ParaView developers would.
>>>
>>>
>>>> Why won't the debug version of QVTKWidgetPlugin.dll register in
>>>> designer?
>>>>
>>>
>>> Because you've got a release build of the designer.  Debug builds of
>>> plugins
>>> are ignored.
>>> You only need to build one plugin, either debug or release to match your
>>> designer.  With that, you can create user interfaces that get compiled
>>> into
>>> your applications.  Those applications you create do not link with the
>>> plugin, but rather with the QVTK library.
>>>
>>>
>>> Clint
>>>
>>>
>>>> I am using QT-4.3.4. Vista, Visual Studio Version 9.
>>>>
>>>> Andrew
>>>>
>>>>
>>>>
>>>> On Tue, Aug 5, 2008 at 2:11 PM, Clinton Stimpson <clinton at elemtech.com>
>>>> wrote:
>>>>>
>>>>> Probably no one else has tried to do that.  They either copy the plugin
>>>>> into
>>>>> the Qt designer plugin directory, or don't use a debug version of the
>>>>> Qt
>>>>> designer.
>>>>>
>>>>> Adding a "d" postfix is fine with me.
>>>>>
>>>>> Clint
>>>>>
>>>>> On Aug 4, 2008, at 9:51 PM, Andrew Maclean wrote:
>>>>>
>>>>>> When using Windows, how do developers handle the problem of debug and
>>>>>> release versions of QVTKWidgetPlugin.dll?
>>>>>> The issue I have is that I have release versions of the library in my
>>>>>> path and consequently when I set QT_PLUGIN_PATH="C:\Program
>>>>>> Files\VTK\plugins" of course, it only picks up one version, namely the
>>>>>> release version.
>>>>>>
>>>>>> Does anyone see any problems modifing:
>>>>>> IF(NOT VTK_NO_LIBRARY_VERSION)
>>>>>>  SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES}
>>>>>>  VERSION "${VTK_VERSION}"
>>>>>>  SOVERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}"
>>>>>>  )
>>>>>> ENDIF(NOT VTK_NO_LIBRARY_VERSION)
>>>>>>
>>>>>> to
>>>>>> IF(NOT VTK_NO_LIBRARY_VERSION)
>>>>>>  SET(VTK_LIBRARY_PROPERTIES ${VTK_LIBRARY_PROPERTIES}
>>>>>>  VERSION "${VTK_VERSION}"
>>>>>>  SOVERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}"
>>>>>>  DEBUG_POSTFIX "d"
>>>>>>  )
>>>>>> ENDIF(NOT VTK_NO_LIBRARY_VERSION)
>>>>>>
>>>>>> Which will add a "d" postfix to the debug versions of the libraries?
>>>>>>
>>>>>> Thanks in advance for any comments
>>>>>>
>>>>>> 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/
>>>>>> ___________________________________________
>>>>>> _______________________________________________
>>>>>> vtk-developers mailing list
>>>>>> vtk-developers at vtk.org
>>>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>>
>>>>> _______________________________________________
>>>>> vtk-developers mailing list
>>>>> vtk-developers at vtk.org
>>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> ___________________________________________
>>>> 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/
>>>> ___________________________________________
>>>
>>> _______________________________________________
>>> vtk-developers mailing list
>>> vtk-developers at vtk.org
>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>
>>
>>
>>
>> --
>> ___________________________________________
>> 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/
>>
>> ___________________________________________<CMakeCache.txt><LoadedDLLs.txt>
>
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



-- 
___________________________________________
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