2013-10-27 274 views
3

CGAL链接错误我安装CGAL与MacPorts的:在Mac OS X

$ sudo port install cgal 

然后建立我的样本代码的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 f在链接阶段出现以下错误。 Exact_predicates_exact_constructions_kernel工作正常。

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

+1

'cgal_create_CMakeLists -c Core' –

+0

谢谢!就是这样。 '-c'-甚至不会出现在'-h'中......你想让它成为答案? – mb21

回答

5

正如installation documentation解释,cgal_create_CMakeLists接受参数指定它应该链接CGAL和BOOST组件。在这种情况下,您需要-c Core。需要自动检测哪些组件是相当有限的,所以您通常需要自己指定它们。

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

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

CGAL_COMPONENT Core 

注意,脚本不累积选项,如果你使用其中几种方法。

+0

'cgal_create_cmake_script'是另一个脚本,似乎自动拉入Core。 –