CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.96k stars 1.38k forks source link

Missing 'Vector' and 'Matrix' types in CGAL::Default namespace #7517

Closed altonlm closed 1 year ago

altonlm commented 1 year ago

Please use the following template to help us solving your issue.

Issue Details

I'm trying to build the MCF_Skeleton_example.cpp example file however it seems like the compiler is unable to find the Vector or Matrix types.

Source Code

I am using the example file listed above and compiling via these shell commands: % /opt/homebrew/bin/cgal_create_CMakeLists % cmake -DCMAKE_BUILD_TYPE=Release . % make

after which I get these messages:

CGAL_COMPONENTS: moving CMakeLists.txt to CMakeLists.txt.bak ...

# Created by the script cgal_create_CMakeLists # This is the CMake script for compiling a set of CGAL applications.

cmake_minimum_required(VERSION 3.1...3.23)

project( test )

# CGAL and its components find_package( CGAL QUIET COMPONENTS )

if ( NOT CGAL_FOUND )

message(STATUS "This project requires the CGAL library, and will not be compiled.") return()

endif()

# Boost and its components find_package( Boost REQUIRED )

if ( NOT Boost_FOUND )

message(STATUS "This project requires the Boost library, and will not be compiled.")

return()

endif()

# include for local directory

# include for local package

# Creating entries for all C++ files with "main" routine # ##########################################################

create_single_source_cgal_program( "MCF_Skeleton_example.cpp" )

created CMakeLists.txt in /Users/altonmiles/Desktop/Makaroff/cgal/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/test ... -- Using header-only CGAL -- Targetting Unix Makefiles -- Using /Library/Developer/CommandLineTools/usr/bin/c++ compiler. -- Running in macOS DARWIN_VERSION=22 -- Found Boost: /opt/homebrew/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.66")
-- Boost include dirs: /opt/homebrew/include -- Boost libraries:
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0")
-- Configuring done (0.1s) -- Generating done (0.0s) -- Build files have been written to: /Users/altonmiles/Desktop/Makaroff/cgal/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/test [ 50%] Building CXX object CMakeFiles/MCF_Skeleton_example.dir/MCF_Skeleton_example.cpp.o In file included from /Users/altonmiles/Desktop/Makaroff/cgal/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/test/MCF_Skeleton_example.cpp:3: /opt/homebrew/include/CGAL/Mean_curvature_flow_skeletonization.h:895:44: error: no type named 'Matrix' in 'CGAL::Default' void assemble_LHS(typename SolverTraits::Matrix& A)


/Users/altonmiles/Desktop/Makaroff/cgal/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/test/MCF_Skeleton_example.cpp:14:9: note: in instantiation of template class 'CGAL::Mean_curvature_flow_skeletonization<CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>>>' requested here
typedef Skeletonization::Skeleton                             Skeleton;
        ^
In file included from /Users/altonmiles/Desktop/Makaroff/cgal/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/test/MCF_Skeleton_example.cpp:3:
/opt/homebrew/include/CGAL/Mean_curvature_flow_skeletonization.h:956:44: error: no type named 'Vector' in 'CGAL::Default'
  void assemble_RHS(typename SolverTraits::Vector& Bx,
                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/opt/homebrew/include/CGAL/Mean_curvature_flow_skeletonization.h:629:28: error: no type named 'Matrix' in 'CGAL::Default'
    typename SolverTraits::Matrix A(nrows, nver);
    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/altonmiles/Desktop/Makaroff/cgal/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/test/MCF_Skeleton_example.cpp:35:7: note: in instantiation of member function 'CGAL::Mean_curvature_flow_skeletonization<CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>>>::contract_geometry' requested here
  mcs.contract_geometry();
      ^
3 errors generated.
make[2]: *** [CMakeFiles/MCF_Skeleton_example.dir/MCF_Skeleton_example.cpp.o] Error 1
make[1]: *** [CMakeFiles/MCF_Skeleton_example.dir/all] Error 2
make: *** [all] Error 2

## Environment

* Operating system (Windows/Mac/Linux, 32/64 bits): Arm MacOS 13.4
* Compiler: XCode C++ compiler Apple clang version 14.0.0
* Release or debug mode: Release
* Specific flags used (if any): none
* CGAL version: 5.5.2
* Boost version: 1.81.0
* Other libraries versions if used (Eigen, TBB, etc.): none

Thank you for the help!
sloriot commented 1 year ago

Why did you run cgal_create_CMakeLists and not use the cmake script provided by CGAL? If you look at the cmake script shipped with CGAL, you will see some lines about finding Eigen and "linking" it.

altonlm commented 1 year ago

You're right! I assumed that running that file would always take care of the CMakeLists.txt file creation so I bundled it together with the other two commands in a shell function for ease of use. Everything works properly now! Thank you for the help!