VTK6.3.0 error: no override found for 'vtkPolyDataMapper'


1 开发环境

    计算机系统: Win7

    Qt版本: 5.4.0

    Qt Creator版本: 3.0.1

    VTK版本:  6.3.0

    编译器: VS2013


2 解决方法1

    根据参考资料[1]的说明,在源程序中添加头文件

  1. #include <vtkAutoInit.h>  
    然后在main函数的开始处添加
  1. VTK_MODULE_INIT(vtkRenderingOpenGL);  
    重新编译运行,第2中章的问题解决!然是又出现了以下问题:


    在main函数中继续添加

  1. VTK_MODULE_INIT(vtkInteractionStyle);  
    结果问题都解决!

3 解决方法2

    在包含VTK的所有头文件前,先定义一下代码段

  1. #define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)  
  2. #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)  
    这样,同样可以解决第2章和第3章出现的问题。********************************************************************************************************************************************************************

******************************************************************************************************************************************************************


If you build your project with CMake, and you use the standard find_package(VTK) and include(${VTK_USE_FILE}) then this problem should not occur. (Because the defines will be automatically added for you by virtue of the include(${VTK_USE_FILE})...)


The factory methods now require "auto-initialization" depending on what modules are enabled at VTK configure time. If you are enabling all modules, and building your project without using CMake, you will need some defines in your project in order to make the factories work properly.


On September 10, 2013 a new macro was added to make this process a little simpler for projects that just want to initialize modules, where ordering ceases to be important but you must still build a source file into your application that has something along with following (with one entry for each module that should be initialized).

 #include <vtkAutoInit.h>
 VTK_MODULE_INIT(vtkRenderingOpenGL);

This will initialize the vtkRenderingOpenGL object factories, and should be done for each module. If you are using an older version of VTK (6.0 or master from before the date above) than you can try including this snippet in all your code that includes VTK usage, BEFORE including ANY VTK header files:

 #define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
 #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)

See these references (and follow the mailing list threads to their conclusions) for more info:

I have also had the NULL pointer; surely the code should not compile and just dump a NULL pointer as a result of a call to

   theMapper = vtkPolyDataMapper::New();

However after setting the above options (in Windows VStudio 2008 v9 "Property Pages->Preprocessor definitions" for the program I am linking) I get a message from my compiler that some (20) functions were not found. The user at ref [1] seems to have hundreds of missing links.

"2>vtkSDIView.obj : error LNK2001: unresolved external symbol "void __cdecl vtkInteractionStyle_AutoInit_Construct(void)" (?vtkInteractionStyle_AutoInit_Construct@@YAXXZ) 2>vtkSDI.cpp.obj : error LNK2001: unresolved external symbol "void __cdecl vtkInteractionStyle_AutoInit_Destruct(void)"(?vtkInteractionStyle_AutoInit_Destruct@@YAXXZ)"

After linking all the libraries found in the example code (eg the Cone example) these link errors go away. This required adding several tens of new libraries that I had not needed to link for version 5.8 which is slightly annoying. The preprocessor definitions I mention above can also be copied from the Cone example.

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值