Mac OS X上的CGAL链接错误 [英] CGAL Linking Error on Mac OS X

查看:97
本文介绍了Mac OS X上的CGAL链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在macports上安装了cgal:

I installed cgal with macports:

$ sudo port install cgal

然后使用cmake构建示例代码:

Then building my sample code with cmake:

$ cgal_create_CMakeLists -s out
$ cmake .
$ make

cmake成功返​​回:

-- Requested component: MPFR
-- Requested component: GMP
-- Boost version: 1.54.0
-- Configuring done
-- Generating done
-- Build files have been written to: [...]

但是,当我尝试在我的.cpp文件中使用Exact_predicates_exact_constructions_kernel_with_sqrt内核时,make在链接阶段失败,并出现以下错误. Exact_predicates_exact_constructions_kernel正常.

But as soon as I try to use the Exact_predicates_exact_constructions_kernel_with_sqrt kernel in my .cpp file, make fails in the linking stage with the following error. Exact_predicates_exact_constructions_kernel works fine.

Linking CXX executable out
Undefined symbols for architecture x86_64:
  "CORE::EscapePrec", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::core_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, bool)", referenced from:
      CORE::filteredFp::operator/(CORE::filteredFp const&) const in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Add>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
      CORE::filteredFp::sqrt() const in hello-really-exact.cpp.o
  "CORE::defAbsPrec", referenced from:
      CORE::Real::Real(CORE::BigRat const&) in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigRat>::BigFloatValue() const in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigRat>::sqrt(CORE::extLong const&) const in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigRat>::sqrt(CORE::extLong const&, CORE::BigFloat const&) const in hello-really-exact.cpp.o
  "CORE::defRelPrec", referenced from:
      CORE::Real::Real(CORE::BigRat const&) in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigRat>::BigFloatValue() const in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigRat>::sqrt(CORE::extLong const&) const in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigRat>::sqrt(CORE::extLong const&, CORE::BigFloat const&) const in hello-really-exact.cpp.o
  "CORE::BigFloatRep::add(CORE::BigFloatRep const&, CORE::BigFloatRep const&)", referenced from:
      CORE::Real CORE::_real_add::eval<CORE::BigFloat>(CORE::BigFloat const&, CORE::BigFloat const&) in hello-really-exact.cpp.o
  "CORE::BigFloatRep::div(CORE::BigInt const&, CORE::BigInt const&, CORE::extLong const&, CORE::extLong const&)", referenced from:
      CORE::BigFloat::approx(CORE::BigRat const&, CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
      CORE::BigFloat::BigFloat(CORE::BigRat const&, CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
  "CORE::BigFloatRep::sub(CORE::BigFloatRep const&, CORE::BigFloatRep const&)", referenced from:
      CORE::Real CORE::_real_sub::eval<CORE::BigFloat>(CORE::BigFloat const&, CORE::BigFloat const&) in hello-really-exact.cpp.o
  "CORE::BigFloatRep::sqrt(CORE::BigFloatRep const&, CORE::extLong const&)", referenced from:
      CORE::BigFloat::sqrt(CORE::extLong const&) const in hello-really-exact.cpp.o
  "CORE::BigFloatRep::sqrt(CORE::BigFloatRep const&, CORE::extLong const&, CORE::BigFloat const&)", referenced from:
      CORE::BigFloat::sqrt(CORE::extLong const&, CORE::BigFloat const&) const in hello-really-exact.cpp.o
  "CORE::BigFloatRep::trunc(CORE::BigInt const&, CORE::extLong const&, CORE::extLong const&)", referenced from:
      CORE::Realbase_for<long>::approx(CORE::extLong const&, CORE::extLong const&) const in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigInt>::approx(CORE::extLong const&, CORE::extLong const&) const in hello-really-exact.cpp.o
  "CORE::BigFloatRep::approx(CORE::BigFloatRep const&, CORE::extLong const&, CORE::extLong const&)", referenced from:
      CORE::Realbase_for<CORE::BigFloat>::approx(CORE::extLong const&, CORE::extLong const&) const in hello-really-exact.cpp.o
  "CORE::InvalidFlag", referenced from:
      CORE::sqrt(CORE::Expr const&) in hello-really-exact.cpp.o
      CORE::operator/(CORE::Expr const&, CORE::Expr const&) in hello-really-exact.cpp.o
  "CORE::fpFilterFlag", referenced from:
      CORE::filteredFp::isOK() const in hello-really-exact.cpp.o
  "CORE::EscapePrecFlag", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::EscapePrecWarning", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::rationalReduceFlag", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::progressiveEvalFlag", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::defInitialProgressivePrec", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::Add::name", referenced from:
      CORE::AddSubRep<CORE::Add>::op() const in hello-really-exact.cpp.o
  "CORE::Sub::name", referenced from:
      CORE::AddSubRep<CORE::Sub>::op() const in hello-really-exact.cpp.o
  "CORE::clLg(long)", referenced from:
      CORE::Realbase_for<long>::length() const in hello-really-exact.cpp.o
      CORE::Realbase_for<long>::height() const in hello-really-exact.cpp.o
  "CORE::clLg(unsigned long)", referenced from:
      CORE::Realbase_for<long>::ULV_E(CORE::extLong&, CORE::extLong&, CORE::extLong&, CORE::extLong&, CORE::extLong&, CORE::extLong&) const in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigFloat>::clLgErr() const in hello-really-exact.cpp.o
  "CORE::flrLg(long)", referenced from:
      CORE::Real::Real(long) in hello-really-exact.cpp.o
  "CORE::flrLg(unsigned long)", referenced from:
      CORE::_real_binary_op<CORE::_real_add>::eval(CORE::RealRep const&, CORE::RealRep const&) in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigFloat>::flrLgErr() const in hello-really-exact.cpp.o
      CORE::_real_binary_op<CORE::_real_sub>::eval(CORE::RealRep const&, CORE::RealRep const&) in hello-really-exact.cpp.o
  "CORE::ExprRep::degreeBound()", referenced from:
      CORE::sqrt(CORE::Expr const&) in hello-really-exact.cpp.o
      CORE::operator/(CORE::Expr const&, CORE::Expr const&) in hello-really-exact.cpp.o
      CORE::Expr::cmp(CORE::Expr const&) const in hello-really-exact.cpp.o
  "CORE::ExprRep::getAppValue(CORE::extLong const&, CORE::extLong const&)", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Add>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
  "CORE::ExprRep::computeBound()", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::ExprRep::reduceToZero()", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::ExprRep::reduceToBigRat(CORE::BigRat const&)", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::ExprRep::reduceTo(CORE::ExprRep const*)", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::ExprRep::ExprRep()", referenced from:
      CORE::DivRep::DivRep(CORE::ExprRep*, CORE::ExprRep*) in hello-really-exact.cpp.o
      CORE::MultRep::MultRep(CORE::ExprRep*, CORE::ExprRep*) in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Add>::AddSubRep(CORE::ExprRep*, CORE::ExprRep*) in hello-really-exact.cpp.o
      CORE::Expr::operator-() const in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::AddSubRep(CORE::ExprRep*, CORE::ExprRep*) in hello-really-exact.cpp.o
      CORE::Expr::Expr(int) in hello-really-exact.cpp.o
      CORE::Expr::Expr() in hello-really-exact.cpp.o
      ...
  "CORE::extLong::getNegInfty()", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::_real_binary_op<CORE::_real_add>::eval(CORE::RealRep const&, CORE::RealRep const&) in hello-really-exact.cpp.o
      CORE::Real::Real(long) in hello-really-exact.cpp.o
      CORE::Realbase_for<long>::flrLgErr() const in hello-really-exact.cpp.o
      CORE::Realbase_for<long>::clLgErr() const in hello-really-exact.cpp.o
      CORE::Real::Real(CORE::BigInt const&) in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigInt>::flrLgErr() const in hello-really-exact.cpp.o
      ...
  "CORE::extLong::getPosInfty()", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::_real_binary_op<CORE::_real_add>::eval(CORE::RealRep const&, CORE::RealRep const&) in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::_real_binary_op<CORE::_real_sub>::eval(CORE::RealRep const&, CORE::RealRep const&) in hello-really-exact.cpp.o
  "CORE::extLong::operator-=(CORE::extLong const&)", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Add>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigRat>::ULV_E(CORE::extLong&, CORE::extLong&, CORE::extLong&, CORE::extLong&, CORE::extLong&, CORE::extLong&) const in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
  "CORE::extLong::operator*=(CORE::extLong const&)", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
  "CORE::extLong::operator+=(CORE::extLong const&)", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Add>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
      CORE::_real_binary_op<CORE::_real_add>::eval(CORE::RealRep const&, CORE::RealRep const&) in hello-really-exact.cpp.o
      CORE::Real::Real(CORE::BigRat const&) in hello-really-exact.cpp.o
      CORE::Real::Real(CORE::BigFloat const&) in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigFloat>::flrLgErr() const in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigFloat>::clLgErr() const in hello-really-exact.cpp.o
      ...
  "CORE::BinOpRep::initNodeInfo()", referenced from:
      vtable for CORE::AddSubRep<CORE::Add> in hello-really-exact.cpp.o
      vtable for CORE::AddSubRep<CORE::Sub> in hello-really-exact.cpp.o
  "CORE::BinOpRep::count()", referenced from:
      vtable for CORE::AddSubRep<CORE::Add> in hello-really-exact.cpp.o
      vtable for CORE::AddSubRep<CORE::Sub> in hello-really-exact.cpp.o
  "CORE::BinOpRep::clearFlag()", referenced from:
      vtable for CORE::AddSubRep<CORE::Add> in hello-really-exact.cpp.o
      vtable for CORE::AddSubRep<CORE::Sub> in hello-really-exact.cpp.o
  "CORE::io_write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, __mpq_struct const*)", referenced from:
      CORE::Realbase_for<CORE::BigRat>::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in hello-really-exact.cpp.o
  "CORE::io_write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, __mpz_struct const*)", referenced from:
      CORE::Realbase_for<CORE::BigInt>::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in hello-really-exact.cpp.o
  "CORE::AbortFlag", referenced from:
      CORE::sqrt(CORE::Expr const&) in hello-really-exact.cpp.o
      CORE::operator/(CORE::Expr const&, CORE::Expr const&) in hello-really-exact.cpp.o
  "CORE::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, CORE::extLong const&)", referenced from:
      CORE::AddSubRep<CORE::Add>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Add>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeExactFlags() in hello-really-exact.cpp.o
      CORE::AddSubRep<CORE::Sub>::computeApproxValue(CORE::extLong const&, CORE::extLong const&) in hello-really-exact.cpp.o
  "CORE::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, CORE::ExprRep&)", referenced from:
      _main in hello-really-exact.cpp.o
  "CORE::BigFloatRep::compareMExp(CORE::BigFloatRep const&) const", referenced from:
      CORE::BigFloat::longValue() const in hello-really-exact.cpp.o
  "CORE::BigFloatRep::toLong() const", referenced from:
      CORE::BigFloat::longValue() const in hello-really-exact.cpp.o
  "CORE::BigFloatRep::toBigInt() const", referenced from:
      CORE::Realbase_for<CORE::BigFloat>::BigIntValue() const in hello-really-exact.cpp.o
  "CORE::BigFloatRep::toDouble() const", referenced from:
      CORE::Realbase_for<CORE::BigFloat>::doubleValue() const in hello-really-exact.cpp.o
  "CORE::BigFloatRep::toDecimal(unsigned int, bool) const", referenced from:
      CORE::Realbase_for<CORE::BigFloat>::toString(long, bool) const in hello-really-exact.cpp.o
      CORE::Realbase_for<CORE::BigFloat>::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in hello-really-exact.cpp.o
  "CORE::extLong::operator-() const", referenced from:
      CORE::_real_binary_op<CORE::_real_add>::eval(CORE::RealRep const&, CORE::RealRep const&) in hello-really-exact.cpp.o
      CORE::_real_binary_op<CORE::_real_sub>::eval(CORE::RealRep const&, CORE::RealRep const&) in hello-really-exact.cpp.o
  "CORE::BinOpRep::debugList(int, int) const", referenced from:
      vtable for CORE::AddSubRep<CORE::Add> in hello-really-exact.cpp.o
      vtable for CORE::AddSubRep<CORE::Sub> in hello-really-exact.cpp.o
  "CORE::BinOpRep::debugTree(int, int, int) const", referenced from:
      vtable for CORE::AddSubRep<CORE::Add> in hello-really-exact.cpp.o
      vtable for CORE::AddSubRep<CORE::Sub> in hello-really-exact.cpp.o
  "typeinfo for CORE::BinOpRep", referenced from:
      typeinfo for CORE::AddSubRep<CORE::Add> in hello-really-exact.cpp.o
      typeinfo for CORE::AddSubRep<CORE::Sub> in hello-really-exact.cpp.o
  "vtable for CORE::UnaryOpRep", referenced from:
      CORE::UnaryOpRep::~UnaryOpRep() in hello-really-exact.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for CORE::ConstDoubleRep", referenced from:
      CORE::Expr::Expr(int) in hello-really-exact.cpp.o
      CORE::Expr::Expr() in hello-really-exact.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for CORE::DivRep", referenced from:
      CORE::DivRep::DivRep(CORE::ExprRep*, CORE::ExprRep*) in hello-really-exact.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for CORE::NegRep", referenced from:
      CORE::Expr::operator-() const in hello-really-exact.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for CORE::MultRep", referenced from:
      CORE::MultRep::MultRep(CORE::ExprRep*, CORE::ExprRep*) in hello-really-exact.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for CORE::SqrtRep", referenced from:
      CORE::SqrtRep::SqrtRep(CORE::ExprRep*) in hello-really-exact.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for CORE::BinOpRep", referenced from:
      CORE::BinOpRep::~BinOpRep() in hello-really-exact.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
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]: *** [out] Error 1
make[1]: *** [CMakeFiles/out.dir/all] Error 2
make: *** [all] Error 2

我在Mac OS X 10.9.0上

I'm on Mac OS X 10.9.0

推荐答案

As explained in the installation documentation, cgal_create_CMakeLists takes arguments to specify the CGAL and BOOST components it should link with. In this case, you want -c Core. The automatic detection of which components are needed is fairly limited, so you usually need to specify them yourself.

$ cgal_create_CMakeLists -c Core -s out
$ cmake .
$ make

另一种方法是在同一目录中创建一个名为cgal_cmake_options的文件,或者在您的主​​目录中创建一个名为.cgal_cmake_options_rc的文件,该文件包含:

An alternative way is to create a file called cgal_cmake_options in the same directory, or a file called .cgal_cmake_options_rc in your home directory, which contains:

CGAL_COMPONENT Core

请注意,如果您使用这些方法中的几种,则脚本不会累积选项.

Note that the script does not accumulate the options if you use several of those methods.

这篇关于Mac OS X上的CGAL链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆