0

我发现这些CGAL示例不能在 Mac OS X 10.9 (Mavericks) 下编译。您可以成功编译主CGAL 4.3库并与之链接,但是当使用某些类型的库时,我收到如下所示的错误。

具体来说,我有兴趣使用Surface_reconstruction_points_3我最初尝试构建的示例,但收到此错误:

Linking CXX executable poisson_reconstruction
Undefined symbols for architecture x86_64:
  "CGAL::File_writer_OFF::write_header(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, unsigned long, unsigned long, unsigned long, bool)", referenced from:
      void CGAL::generic_print_polyhedron<CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::__1::allocator<int> >, CGAL::File_writer_OFF>(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, CGAL::Polyhedron_3<CGAL::Epick, CGAL::Polyhedron_items_3, CGAL::HalfedgeDS_default, std::__1::allocator<int> > const&, CGAL::File_writer_OFF&) in poisson_reconstruction.cpp.o
  "CGAL::is_binary(std::__1::basic_ios<char, std::__1::char_traits<char> >&)", referenced from:
      _main in poisson_reconstruction.cpp.o
  "CGAL::is_pretty(std::__1::basic_ios<char, std::__1::char_traits<char> >&)", referenced from:
      _main in poisson_reconstruction.cpp.o
  "CGAL::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&, CGAL::File_header_OFF&)", referenced from:
      CGAL::Polyhedron_scan_OFF<CGAL::HalfedgeDS_default<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::__1::allocator<int> > >::operator()(CGAL::HalfedgeDS_default<CGAL::Epick, CGAL::I_Polyhedron_derived_items_3<CGAL::Polyhedron_items_3>, std::__1::allocator<int> >&) in poisson_reconstruction.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [poisson_reconstruction] Error 1
make[1]: *** [CMakeFiles/poisson_reconstruction.dir/all] Error 2
make: *** [all] Error 2

为了变得非常特别,我实际上对函数感兴趣CGAL::make_normal_of_point_with_normal_pmap并构建了一个测试用例,只是为了尝试使用它。但是,编译此代码时收到错误消息(如下)。

#include <stdio.h>
#include <vector>

#include <CGAL/trace.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh_default_criteria_3.h>
#include <CGAL/Surface_mesh_default_triangulation_3.h>
#include <CGAL/make_surface_mesh.h>
#include <CGAL/Implicit_surface_3.h>
#include <CGAL/IO/output_surface_facets_to_polyhedron.h>
#include <CGAL/Poisson_reconstruction_function.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/property_map.h>
#include <CGAL/compute_average_spacing.h>
#include <CGAL/Gray_level_image_3.h>

#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef Kernel::Sphere_3 Sphere;

typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Poisson_reconstruction_function<Kernel> Poisson_reconstruction_function;
typedef CGAL::Surface_mesh_default_triangulation_3 STr;
typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;
typedef CGAL::Implicit_surface_3<Kernel, Poisson_reconstruction_function> Surface_3;

typedef STr::Geom_traits STrGT;
typedef FT (*Function)(Point);
typedef CGAL::Implicit_surface_3<STrGT, Function> ImplSurface;
typedef CGAL::Gray_level_image_3<FT, Point> Gray_level_image;
typedef CGAL::Implicit_surface_3<STrGT, Gray_level_image> Gray_level_surface;

FT sphere_function (Point p) {
  const FT x2=p.x()*p.x(), y2=p.y()*p.y(), z2=p.z()*p.z();
  return x2+y2+z2-100;
}


int main(void)
{
    printf("Hello, world!\n");


    std::vector<Point_with_normal> points;
    for (double d=0.0; d<10.0; d+=1.0)
    {
        Point_with_normal p( 0.0, 1.0*(d), 1.0*(d*d), Vector(0.0, 1.0, 0.0) );
        points.push_back(p);
    }

    Poisson_reconstruction_function function(points.begin(), points.end(),
                                             CGAL::make_normal_of_point_with_normal_pmap(points.begin()) );

    return 0;
}

以及相应的错误信息:

[100%] Building CXX object CMakeFiles/cgal_test.dir/cgal_test.cpp.o
/usr/bin/c++   -DCGAL_USE_GMP -DCGAL_USE_MPFR -DWITH_CGAL -O3 -DNDEBUG -isystem /usr/local/include -I/Users/chris/dev/intern/test/cgal_testing/build -I/usr/local/Cellar/cgal/4.3/include    -o CMakeFiles/cgal_test.dir/cgal_test.cpp.o -c /Users/chris/dev/intern/test/cgal_testing/cgal_test.cpp
In file included from /Users/chris/dev/intern/test/cgal_testing/cgal_test.cpp:5:
In file included from /usr/local/Cellar/cgal/4.3/include/CGAL/Exact_predicates_inexact_constructions_kernel.h:28:
In file included from /usr/local/Cellar/cgal/4.3/include/CGAL/Simple_cartesian.h:28:
In file included from /usr/local/Cellar/cgal/4.3/include/CGAL/Cartesian/Cartesian_base.h:28:
In file included from /usr/local/Cellar/cgal/4.3/include/CGAL/basic.h:46:
In file included from /usr/local/Cellar/cgal/4.3/include/CGAL/kernel_basic.h:34:
/usr/local/Cellar/cgal/4.3/include/CGAL/Kernel_traits.h:33:23: error: no type named 'R' in
      'std::__1::__wrap_iter<CGAL::Point_with_normal_3<CGAL::Epick> *>'
  typedef typename T::R Kernel;
          ~~~~~~~~~~~~^
/usr/local/Cellar/cgal/4.3/include/CGAL/Point_with_normal_3.h:169:18: note: in instantiation of template class
      'CGAL::Kernel_traits<std::__1::__wrap_iter<CGAL::Point_with_normal_3<CGAL::Epick> *> >' requested here
  typename CGAL::Kernel_traits<Point_with_normal>::Kernel>
                 ^
/usr/local/Cellar/cgal/4.3/include/CGAL/Point_with_normal_3.h:170:3: note: while substituting deduced template arguments into function template
      'make_normal_of_point_with_normal_pmap' [with Point_with_normal = std::__1::__wrap_iter<CGAL::Point_with_normal_3<CGAL::Epick> *>]
  make_normal_of_point_with_normal_pmap(Point_with_normal)
  ^
/Users/chris/dev/intern/test/cgal_testing/cgal_test.cpp:60:13: error: no matching function for call to 'make_normal_of_point_with_normal_pmap'
                                                                                         CGAL::make_normal_of_point_with_normal_pmap(points.begin()) );
                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/cgal/4.3/include/CGAL/Point_with_normal_3.h:170:3: note: candidate template ignored: substitution failure [with Point_with_normal =
      std::__1::__wrap_iter<CGAL::Point_with_normal_3<CGAL::Epick> *>]
  make_normal_of_point_with_normal_pmap(Point_with_normal)
  ^
2 errors generated.
make[2]: *** [CMakeFiles/cgal_test.dir/cgal_test.cpp.o] Error 1
make[1]: *** [CMakeFiles/cgal_test.dir/all] Error 2
make: *** [all] Error 2

正如预期的那样,构建所有示例的标准方法也会触发错误(这里我尝试构建所有 CGAL 示例)。为了到达那里,我曾经从源代码cmake构建库并在设置中CGAL 4.3启用。WITH_examples编译时我调用了makeand make examples,导致了这个错误:

    [ 15%] Building CXX object examples/Segment_Delaunay_graph_2/CMakeFiles/sdg-info-set.dir/sdg-info-set.cpp.o
Linking CXX executable Compute_Ridges_Umbilics
Undefined symbols for architecture x86_64:
  "boost::program_options::to_internal(std::string const&)", referenced from:
      std::vector<std::string, std::allocator<std::string> > boost::program_options::to_internal<std::string>(std::vector<std::string, std::allocator<std::string> > const&) in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)", referenced from:
      _main in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::invalid_option_value::invalid_option_value(std::string const&)", referenced from:
      void boost::program_options::validate<double, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double*, long) in Compute_Ridges_Umbilics.cpp.o
      void boost::program_options::validate<unsigned int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, unsigned int*, long) in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::error_with_option_name::error_with_option_name(std::string const&, std::string const&, std::string const&, int)", referenced from:
      std::basic_string<char, std::char_traits<char>, std::allocator<char> > const& boost::program_options::validators::get_single_string<char>(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::string, std::string>, std::string const&>)", referenced from:
      boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::string, std::string>, std::string const&>) in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::detail::cmdline::cmdline(std::vector<std::string, std::allocator<std::string> > const&)", referenced from:
      boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*) in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::validate(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, std::string*, int)", referenced from:
      boost::program_options::typed_value<std::string, char>::xparse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&) const in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::validate(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool*, int)", referenced from:
      boost::program_options::typed_value<bool, char>::xparse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&) const in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::operator<<(std::ostream&, boost::program_options::options_description const&)", referenced from:
      _main in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const", referenced from:
      vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::invalid_option_value> > in Compute_Ridges_Umbilics.cpp.o
      vtable for boost::exception_detail::error_info_injector<boost::program_options::invalid_option_value> in Compute_Ridges_Umbilics.cpp.o
      vtable for boost::program_options::invalid_option_value in Compute_Ridges_Umbilics.cpp.o
      vtable for boost::program_options::validation_error in Compute_Ridges_Umbilics.cpp.o
      vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::validation_error> > in Compute_Ridges_Umbilics.cpp.o
      vtable for boost::exception_detail::error_info_injector<boost::program_options::validation_error> in Compute_Ridges_Umbilics.cpp.o
  "boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const", referenced from:
      vtable for boost::program_options::typed_value<bool, char> in Compute_Ridges_Umbilics.cpp.o
      vtable for boost::program_options::typed_value<double, char> in Compute_Ridges_Umbilics.cpp.o
      vtable for boost::program_options::typed_value<unsigned int, char> in Compute_Ridges_Umbilics.cpp.o
      vtable for boost::program_options::typed_value<std::string, char> in Compute_Ridges_Umbilics.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [examples/Ridges_3/Compute_Ridges_Umbilics] Error 1
make[2]: *** [examples/Ridges_3/CMakeFiles/Compute_Ridges_Umbilics.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....

最后,如果您知道如何使该make_normal_of_point_with_normal_pmap功能再次起作用,那将是非常棒的。我真的不需要构建所有示例,但想CGAL再次使用那部分。谢谢!

4

1 回答 1

1

我并不完全熟悉CGAL,但我会冒险猜测您已经使用 . 编译了一些代码libc++,而使用libstdc++.

于 2013-10-30T17:50:21.150 回答