[vtkusers] vtk 6.3.0 | Using OpenGL2?

Audrius Stundzia audrius at tomographix.com
Thu Sep 10 12:19:21 EDT 2015


Hello,

> Are you using CMake to build your app as well?

? No, I am not. Building the VTK project, including header files, and
linking the shared libs should be sufficient, should it not, as is the
case with any other 3rd party library. I don't think that I should have
to learn how to write CMake just to use, as opposed to develop, VTK, as
VTK one of many 3rd party library tools that we use.

>
> If not, are you defining the autoinit macros before including VTK
> header files, as discussed here?
> http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines

Thank you for the link.

Yes, that was the bit of info that I did manage to find.

I have the following

#include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);

in stdafx.h

which generated the two link errors listed below.

Adding

VTK_MODULE_INIT(vtkRenderingFreeType);
VTK_MODULE_INIT(vtkRenderingFreeTypeOpenGL2);
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2);

only generates new link error messages of the type

1>stdafx.obj : error LNK2019: unresolved external symbol "void __cdecl
  vtkRenderingFreeTypeOpenGL2_AutoInit_Construct(void)"
  (?vtkRenderingFreeTypeOpenGL2_AutoInit_Construct@@YAXXZ) referenced in
  function "public: __cdecl vtkRenderingFreeTypeOpenGL2_ModuleInit::vtk-
  RenderingFreeTypeOpenGL2_ModuleInit(void)"
  (??0vtkRenderingFreeTypeOpenGL2_ModuleInit@@QEAA at XZ)

There is also the CMake switch

VTK VTK_MAKE_INSTANTIATORS [On or Off]

However, turning this on or off does not change the linking problem.

Regarding the last comment by the author of the Wiki note,  I am linking
to all libs generated by VTK, with as many as possible to be removed
later, yet still receiving this error message.

If there additional unique vtk-specific code that one needs to add,
above and beyond the standard C++ setup, in order to use vtk, I think
that it is reasonable that these steps be documented.

Thank you.

>
>
> HTH, David C.
>
>>
>>
>>
>> On Thu, Sep 10, 2015, at 02:42, Audrius Stundzia wrote: Hello,
>>
>> OS: Windows 10 x64 CMAKE: 3.3.0 IDE: VS MS2015 x64 VTK: 6.3.0 VTK
>> BUILD: Debug x64
>>
>> VTK built in Debug and installed okay. Thank you.
>>
>> Attempting to switch to OpenGL2.
>>
>> In CMAKE, the relevant switches set
>>
>> BUILD
>>
>> BUILD_SHARED_LIBS [On]
>>
>> MODULE
>>
>> Module_vtkRenderingContextOpenGL2 [On]
>>
>> Module_vtkRenderingOpenGL2 [On]
>>
>> Module_vtkRenderingVolumeOpenGL2 [On]
>>
>> Module_vtkglew [On]
>>
>> VTK
>>
>> VTK_LEGACY_REMOVE [On]
>>
>> VTK_LEGACY_SILENT [On]
>>
>> VTK_RENDERING_BACKEND OpenGL2
>>
>> [CMake cache cleared before running Configure with OpenGL2
>> switches set]
>>
>> Including shared vtk libs in a project. Build progresses fine [as
>> before] until the last linking libraries stage
>>
>> 1> Finished searching libraries
>> 1>stdafx.obj : error LNK2019: unresolved external symbol
>>   "__declspec(dllimport) public: __cdecl vtkRenderingOpenGL2Instanti-
>>   ator::vtkRenderingOpenGL2Instantiator(void)"
>>   (__imp_??0vtkRenderingOpenGL2Instantiator@@QEAA at XZ) referenced in
>>   function "void __cdecl `dynamic initializer for
>>   'vtkRenderingOpenGL2InstantiatorInitializer''(void)"
>>   (??__EvtkRenderingOpenGL2InstantiatorInitializer@@YAXXZ)
>>
>> 1>stdafx.obj : error LNK2019: unresolved external symbol
>>   "__declspec(dllimport) public: __cdecl vtkRenderingOpenGL2Instanti-
>>   ator::~vtkRenderingOpenGL2Instantiator(void)"
>>   (__imp_??1vtkRenderingOpenGL2Instantiator@@QEAA at XZ) referenced in
>>   function "void __cdecl `dynamic atexit destructor for
>>   'vtkRenderingOpenGL2InstantiatorInitializer''(void)"
>>   (??__FvtkRenderingOpenGL2InstantiatorInitializer@@YAXXZ)
>>
>> Have included all created vtk libs and dlls in the project, so
>> puzzled as to why these external vtk symbols have not been resolved.
>>
>> Google and vtk user mailing list did unfortunately not provide
>> insight.
>>
>> Please advise.
>>
>> Regards.
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150910/806a04c4/attachment.html>


More information about the vtkusers mailing list