Home:ALL Converter>CGAL Skeletonization compile errors

CGAL Skeletonization compile errors

Ask Time:2018-01-20T16:58:28         Author:Oleksandr Korniienko

Json Formatter

I'm new to C++ and CGAL, previously I worked mainly with C#.

I installed CGAL as described on https://www.cgal.org/download/windows.html and all steps finished successfully. Then I looked to a CGAL 'Hello world' (https://doc.cgal.org/latest/Manual/Kernel_23_2points_and_segment_8cpp-example.html); here I had no problem also; all the code was compiled and run propertly.

But when I tried with more complex things I got a strange issue. For example I tried to compile Skeletonization (https://doc.cgal.org/latest/Surface_mesh_skeletonization/Surface_mesh_skeletonization_2simple_mcfskel_example_8cpp-example.html); here I got a number of errors like these:

C2039 ''extract_mean_curvature_flow_skeleton'': is not a member of ''CGAL''
C2039 ''Matrix'': is not a member of ''CGAL::Default''
C2039 ''Vector'': is not a member of ''CGAL::Default''

As far as I understand it the #include lines processed without errors, all needed headers exist.

I tried to search the answer and found this: http://cgal-discuss.949826.n4.nabble.com/Problem-on-Surface-mesh-deformation-td4661042.html Unfortunately I don't be sure my case is similar and I don't know what exactly do the line #define CGAL_EIGEN3_ENABLED as recommended there.

In any case I tried to add it and got the same errors as previous if this #define inserted after #include ; in different case arise a lot of errors like this:

LNK2019 unresolved external symbol __imp___gmpq_add referenced in function "class CGAL::Gmpq __cdecl CGAL::operator+(class CGAL::Gmpq const &,class CGAL::Gmpq const &)" (??HCGAL@@YA?AVGmpq@0@AEBV10@0@Z)

I work with VS 2017, in Additional library directories I added:

$(CGAL_DIR)/lib/Debug;$(CGAL_DIR)/lib

in Additional include directories:

$(CGAL_ROOT)\include;$(CGAL_ROOT)\auxiliary\gmp\include;
$(CGAL_DIR)\include;$(BOOST_INCLUDEDIR)

maybe some needed libraries or include directories are missing here?
All the components (CGAL, boost, QT) installed in 64 bits versions as well as test project.

UPD: The question is solved!

The answer was extremely simple (please note I'm new in C++):
1. I loaded and unzip EIGEN (it need not to install); for convenience I create also EIGEN_DIR variable;
2. I added to Additional Include Directories: $(EIGEN_DIR);
3. I added before #include statements #define CGAL_EIGEN3_ENABLED;
4. I added to Additional Dependencies such libs:

$(CGAL_ROOT)\auxiliary\gmp\lib\libmpfr-4.lib
$(CGAL_ROOT)\auxiliary\gmp\lib\libgmp-10.lib

and it start to work!

Author:Oleksandr Korniienko,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/48354266/cgal-skeletonization-compile-errors
yy