Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

cgal

Edoardo_Milotti
Beginner
681 Views
I am trying to compile and link a C++ program that uses CGAL (http://www.cgal.org) on Mac OS X. The basic CGAL libraries were compiled with g++ 4.5 (using MacPorts). However a substantial part of the code is included in the header files and is compiled each time by icpc.

There is some kind of incompatibility between the compilers and/or the CGAL code, because a code that compiles and links perfectly with g++ 4.5, refuses to do so with icpc.

My options are as follows:

icpc -O3 -Wall -wd981 -D_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC=1 -fp-model strict ...

and I get errors like

/opt/local/include/CGAL/Triangulation_ds_cell_base_3.h(50): error: only "()" is allowed as initializer for array member "CGAL::Triangulation_ds_cell_base_3::V"
: V((Vertex_handle[4]) {v0, v1, v2, v3} ) {}
^
detected during:
instantiation of "CGAL::Triangulation_cell_base_3::Triangulation_cell_base_3(Cb::Vertex_handle, Cb::Vertex_handle, Cb::Vertex_handle, Cb::Vertex_handle) [with GT=K, Cb=CGAL::Triangulation_ds_cell_base_3<:TRIANGULATION_DATA_STRUCTURE_3>>]" at line 88 of "/opt/local/include/CGAL/Alpha_shape_cell_base_3.h"
instantiation of "CGAL::Alpha_shape_cell_base_3::Alpha_shape_cell_base_3(Cb::Vertex_handle, Cb::Vertex_handle, Cb::Vertex_handle, Cb::Vertex_handle) [with Gt=K, Cb=CGAL::Triangulation_cell_base_3>>]" at line 301 of "/opt/local/include/CGAL/Compact_container.h"
instantiation of "CGAL::internal::CC_iterator<:COMPACT_CONTAINER>, false> CGAL::Compact_container::emplace(const T1 &, const T2 &, const T3 &, const T4 &) [with T=CGAL::Alpha_shape_cell_base_3>>>, Allocator_=CGAL::Default, T1=CGAL::internal::CC_iterator<:COMPACT_CONTAINER><:ALPHA_SHAPE_VERTEX_BASE_3>
CGAL::Triangulation_vertex_base_with_info_3>>>>, CGAL::Default>, false>, T2=CGAL::internal::CC_iterator<:COMPACT_CONTAINER><:ALPHA_SHAPE_VERTEX_BASE_3>>>>>,
CGAL::Default>, false>, T3=CGAL::internal::CC_iterator<:COMPACT_CONTAINER><:ALPHA_SHAPE_VERTEX_BASE_3>>>>>, CGAL::Default>, false>, T4=CGAL::internal::CC_iterator<:COMPACT_CONTAINER><:ALPHA_SHAPE_VERTEX_BASE_3>
CGAL::Triangulation_vertex_base_3>>>>, CGAL::Default>, false>]" at line 271 of "/opt/local/include/CGAL/Triangulation_data_structure_3.h"
instantiation of "CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator CGAL::Triangulation_data_structure_3::create_face(CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator, CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator,
CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator) [with Vb=Vb, Cb=Fb]" at line 2333 of "/opt/local/include/CGAL/Triangulation_data_structure_3.h"
instantiation of "CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator CGAL::Triangulation_data_structure_3::insert_increase_dimension(CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator) [with Vb=Vb, Cb=Fb]" at line 305 of "/opt/local/include/CGAL/Triangulation_3.h"
instantiation of "void CGAL::Triangulation_3::init_tds() [with GT=K, Tds_=Tds]" at line 314 of "/opt/local/include/CGAL/Triangulation_3.h"
instantiation of "CGAL::Triangulation_3::Triangulation_3(const GT &) [with GT=K, Tds_=Tds]" at line 178 of "/opt/local/include/CGAL/Delaunay_triangulation_3.h"
instantiation of "CGAL::Delaunay_triangulation_3::Delaunay_triangulation_3(const Gt &) [with Gt=K, Tds_=Tds]" at line 38 of "CellsSystem-D-2.cpp"
/opt/local/include/CGAL/Triangulation_ds_cell_base_3.h(50): error: only "()" is allowed as initializer for array member "CGAL::Triangulation_ds_cell_base_3::V" : V((Vertex_handle[4]) {v0, v1, v2, v3} ) {} ^ detected during: instantiation of "CGAL::Triangulation_cell_base_3::Triangulation_cell_base_3(Cb::Vertex_handle, Cb::Vertex_handle, Cb::Vertex_handle, Cb::Vertex_handle) [with GT=K, Cb=CGAL::Triangulation_ds_cell_base_3<:TRIANGULATION_DATA_STRUCTURE_3>>]" at line 88 of "/opt/local/include/CGAL/Alpha_shape_cell_base_3.h" instantiation of "CGAL::Alpha_shape_cell_base_3::Alpha_shape_cell_base_3(Cb::Vertex_handle, Cb::Vertex_handle, Cb::Vertex_handle, Cb::Vertex_handle) [with Gt=K, Cb=CGAL::Triangulation_cell_base_3>>]" at line 301 of "/opt/local/include/CGAL/Compact_container.h" instantiation of "CGAL::internal::CC_iterator<:COMPACT_CONTAINER>, false> CGAL::Compact_container::emplace(const T1 &, const T2 &, const T3 &, const T4 &) [with T=CGAL::Alpha_shape_cell_base_3>>>, Allocator_=CGAL::Default, T1=CGAL::internal::CC_iterator<:COMPACT_CONTAINER><:ALPHA_SHAPE_VERTEX_BASE_3>>>>>, CGAL::Default>, false>, T2=CGAL::internal::CC_iterator<:COMPACT_CONTAINER><:ALPHA_SHAPE_VERTEX_BASE_3>>>>>, CGAL::Default>, false>, T3=CGAL::internal::CC_iterator<:COMPACT_CONTAINER><:ALPHA_SHAPE_VERTEX_BASE_3>>>>>, CGAL::Default>, false>, T4=CGAL::internal::CC_iterator<:COMPACT_CONTAINER><:ALPHA_SHAPE_VERTEX_BASE_3>>>>>, CGAL::Default>, false>]" at line 271 of "/opt/local/include/CGAL/Triangulation_data_structure_3.h" instantiation of "CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator CGAL::Triangulation_data_structure_3::create_face(CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator, CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator, CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator) [with Vb=Vb, Cb=Fb]" at line 2333 of "/opt/local/include/CGAL/Triangulation_data_structure_3.h" instantiation of "CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator CGAL::Triangulation_data_structure_3::insert_increase_dimension(CGAL::Compact_container<:REBIND_TDS><:TRIANGULATION_DATA_STRUCTURE_3>>::Other, CGAL::Default>::iterator) [with Vb=Vb, Cb=Fb]" at line 305 of "/opt/local/include/CGAL/Triangulation_3.h" instantiation of "void CGAL::Triangulation_3::init_tds() [with GT=K, Tds_=Tds]" at line 314 of "/opt/local/include/CGAL/Triangulation_3.h" instantiation of "CGAL::Triangulation_3::Triangulation_3(const GT &) [with GT=K, Tds_=Tds]" at line 178 of "/opt/local/include/CGAL/Delaunay_triangulation_3.h" instantiation of "CGAL::Delaunay_triangulation_3::Delaunay_triangulation_3(const Gt &) [with Gt=K, Tds_=Tds]" at line 38 of "CellsSystem-D-2.cpp"


Does anybody know how to fix this? Thanks.
0 Kudos
6 Replies
Judith_W_Intel
Employee
681 Views

What version of the Intelcompiler are you using? To me this looks like the same problem that is fixed in our 12.0 beta compiler (cq #139862) described here:

10/15/09
GNU array mem-initializers

g++ allows constructor mem-initializers for array members to have non-empty
initializers if the member is an array of a class type with a copy
constructor. We now emulate that in g++ mode.

struct A {
A();
A(const A&);
};
struct B {
A arr[2];
B(const B&p) : arr(p.arr) {} // Now allowed in GNU C++ mode
};

Judy

0 Kudos
Edoardo_Milotti
Beginner
681 Views
I am using version 11.1 (build 088) ...
0 Kudos
TimP
Honored Contributor III
681 Views
As the preceding reponses indicate, g++ 4.5 is too recent to expect compatibility in icpc 11.1, and you may hope for improvement in icpc 12.0, which currently is in beta test.
0 Kudos
Om_S_Intel
Employee
681 Views

Workarround:

Initialize the array one element at a time inside the construtor.

0 Kudos
Om_S_Intel
Employee
681 Views
I will inform the forum users when the compiler with fixed available with fix for download.
0 Kudos
Om_S_Intel
Employee
681 Views
The issue is fixed in latest Intel C++ composure 2001 XE (compiler 12.0). The composure is available for download from Intel registration and download center.
0 Kudos
Reply