您的位置:首页 > 编程语言

解决cgal中的surface_mesh_deformation,代码copy到别处报错

2015-08-02 15:44 357 查看
我只想说我遇到过多少奇葩的bug啊。。。这么奇葩的错误我竟然能debug出来真是醉醉的

cgal4.5之后,有实现surface_mesh_deformation的example。

1.如何正常编译example?

最好是在编译cgal的时候,cmake中的entry就有,勾选上with_eigen,然后配置include目录即可。

这样以后省事,所以编译cgal的时候,要好好检查外置的库,会用到的都先加上。

如果不想重新编译cgal,在重新用cmake编译surface_mesh_deformation这个example和demo时,选择with_eigen即可。

2.当你正常运行example之后,把代码原样copy到自己的project中,编译会报错TTTTTTT

1>C:\Program Files\CGAL-4.6.1\include\CGAL/Surface_mesh_deformation.h(212): error C2039: 'Matrix' : is not a member of 'CGAL::Default'

1> C:\Program Files\CGAL-4.6.1\include\CGAL/Default.h(31) : see declaration of 'CGAL::Default'

1> ModelDecompoent.cpp(245) : see reference to class template instantiation 'CGAL::Surface_mesh_deformation<HG>' being compiled

1> with

1> [

1> HG=Polyhedron

1> ]

......
一堆错

翻墙说加上#define CGAL_EIGEN3_ENABLED
因为看CGAL/Surface_mesh_deformation.h代码中:
#if
defined(CGAL_EIGEN3_ENABLED)

#include <CGAL/Eigen_solver_traits.h> // for sparse linear system solver

#include <CGAL/Deformation_Eigen_polar_closest_rotation_traits_3.h> // for 3x3 closest rotation computer

#endif

就是说CGAL_EIGEN3_ENABLED被define了才可以。

然而我加上并没有用!!!

为什么呢?
因为顺序反了=
=

正确的顺序:
#define
CGAL_EIGEN3_ENABLED

#include <CGAL/Surface_mesh_deformation.h>


错误的顺序:
#include
<CGAL/Surface_mesh_deformation.h>

#define CGAL_EIGEN3_ENABLED
//这样子都include完了,define还有什么用。。。

真是奇葩的bug
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: