CGAL组合地图和Geomview
CGAL Combinatorial map and Geomview
由于某种原因Combinatorial_map对象在被调用后会导致分段错误。
例如(来自CGAL示例):
#include <CGAL/Combinatorial_map.h>
#include <CGAL/Combinatorial_map_constructors.h>
#include <iostream>
#include <cstdlib>
typedef CGAL::Combinatorial_map<3> CMap_3;
typedef CMap_3::Dart_const_handle Dart_const_handle;
int main()
{
CMap_3 cm;
// Create two tetrahedra.
Dart_const_handle dh1 = CGAL::make_combinatorial_tetrahedron(cm);
Dart_const_handle dh2 = CGAL::make_combinatorial_tetrahedron(cm);
// Display the combinatorial map characteristics.
cm.display_characteristics(std::cout);
return EXIT_SUCCESS;
}
导致"分段错误:11",而注释cm.display_characteristics(std::cout);
行会导致编译成功。
同样地:
#include <CGAL/Linear_cell_complex.h>
#include <CGAL/Linear_cell_complex_operations.h>
#include <CGAL/IO/Geomview_stream.h>
#include <iostream>
#include <algorithm>
typedef CGAL::Linear_cell_complex<3> LCC3;
typedef LCC3::Dart_handle DartHandle;
typedef LCC3::Point Point;
typedef LCC3::FT FT;
typedef CGAL::Geomview_stream GVS;
int main(){
LCC3 lcc;
DartHandle d1 = lcc.make_tetrahedron( Point(-1,0,0), Point(0,2,0), Point(1,0,0), Point(1,1,2));
return 0;
}
导致分段故障,可以通过移除DartHandle d1 = lcc.make_tetrahedron( Point(-1,0,0), Point(0,2,0), Point(1,0,0), Point(1,1,2));
线来修复。
我使用 Mac OS 10.10.3 并按如下方式编译我的文件:
cgal_create_CMakeList
cmake -DCGAL_DIR=/usr/local/Cellar/cgal/4.6/ .
make
当我通过以下方式更改为GNU g++编译器时:
cmake -DCGAL_DIR=/usr/local/Cellar/cgal/4.6/ -DCMAKE_CXX_COMPILER:FILEPATH=g++-5 -DCMAKE_C_COMPILER:FILEPATH=gcc-5 .
Geomview 流停止工作,因此以下代码:
#include <CGAL/Linear_cell_complex.h>
#include <CGAL/Linear_cell_complex_operations.h>
#include <CGAL/IO/Geomview_stream.h>
#include <iostream>
#include <algorithm>
typedef CGAL::Linear_cell_complex<3> LCC3;
typedef LCC3::Dart_handle DartHandle;
typedef LCC3::Point Point;
typedef LCC3::FT FT;
typedef CGAL::Geomview_stream GVS;
int main(){
GVS gvs( CGAL::Bbox_3(-10, -10, -10, 120, 60, 60) );
gvs.set_line_width(4);
gvs.set_bg_color(CGAL::Color(0,200,200));
gvs.set_vertex_radius(20);
gvs << CGAL::BLUE;
gvs << Point(0,0,0);
std::cout << "Enter a key to finish" << std::endl;
char ch;
std::cin >> ch;
return 0;
}
结果在:
Undefined symbols for architecture x86_64:
"CGAL::Geomview_stream::get_new_id(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
void CGAL::output_point<double>(CGAL::Geomview_stream&, double const&, double const&, double const&) in cell_complex.cpp.o
"CGAL::Geomview_stream::operator<<(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
void CGAL::output_point<double>(CGAL::Geomview_stream&, double const&, double const&, double const&) in cell_complex.cpp.o
但是用AppleClang编译。
我认为这是您的clang编译器中的一个错误(我的一位同事观察到了类似的行为)。
你能告诉我你使用哪个编译器吗?
如果是相同的问题,则在调试模式下编译时不会发生这种情况。你能试试吗?
纪尧姆
相关文章:
- 为什么不;名字在地图上是按顺序排列的吗
- 基于多个条件处理地图中的所有元素
- 在C++中将矢量转换为嵌套地图
- 替换基于地图的所有引用
- 如何区分地图中的 0 和 false?
- 地图计数确实很重要,或者只是检查是否存在
- 如何从地图中删除矢量对象
- 是否有任何C++功能可以对地图进行排序?
- 如何使用 std::variant 打印地图键/值?
- 从矢量或地图中删除共享指针
- 在 c++ 中,有一种方法可以创建一个包含地图作为值的树状地图?
- 无限嵌套具有变体的地图
- C++一会儿循环读到地图上 2 行?
- 如何在cpp中使用地图显示给定日期范围内(在下面的问题中)的费率?
- 如何检查变量是否是C++中的地图?
- 如何使地图按值C++排序
- 修改地图内矢量中的值
- 为什么我在地图中搜索STL时差很大?
- 我正在尝试按降序对地图进行排序,但没有得到预期的结果?
- CGAL组合地图和Geomview