我只想说我遇到过多少奇葩的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 compiled1> with1> [1> HG=Polyhedron1> ]
……
一堆错
翻墙说加上#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 3×3 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
版权声明:本文为博主原创文章,未经博主允许不得转载。
到尽头,也许快乐,或有时孤独,如果心在远方,