|
Boost Users : |
Subject: [Boost-users] newbie needs help with a linker problem
From: Phil Huffman (56phil_at_[hidden])
Date: 2013-03-08 19:47:51
Hello,
I just installed Boost and GMP on my Mac, using all defaults. I want to use
GMP via Boost, but
there is a problem with the linker. I'm sure that clang is getting a bit
lost looking for GMP's object
modules. Any help will be gratefully accepted. Thanks.
When I compile the below program:
#include <boost/multiprecision/gmp.hpp>
using namespace boost::multiprecision;
int main() {
mpz_int v = 1;
for (unsigned i = 1; i <= 1000; ++i) {
v *= i;
}
std::cout << "1000! = " << v << std::endl; // prints 1000!
return 0;
}
using this command:
c++ -I /usr/local/boost_1_53_0 mpz1.cpp -o mpz1 -v
I get this:
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
"/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier
-main-file-name mpz1.cpp -pic-level 1 -mdisable-fp-elim -relaxed-aliasing
-masm-verbose -munwind-tables
-target-cpu core2 -target-linker-version 134.9 -v -resource-dir
/usr/bin/../lib/clang/4.1 -I /usr/local/boost_1_53_0
-fmodule-cache-path
/var/folders/hj/zc5pjqjd6gxgq2sw77xghkyh0000gn/T/clang-module-cache
-fdeprecated-macro
-fdebug-compilation-dir /Users/56phil/Dev/boostTest -ferror-limit 19
-fmessage-length 272 -stack-protector 1
-mstackrealign -fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics
-o /var/folders/hj/zc5pjqjd6gxgq2sw77xghkyh0000gn/T/mpz1-KE6NKq.o -x c++
mpz1.cpp
clang -cc1 version 4.1 based upon LLVM 3.1svn default target
x86_64-apple-darwin12.2.0
ignoring nonexistent directory
"/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64"
ignoring nonexistent directory "/usr/include/c++/4.0.0"
ignoring nonexistent directory "/usr/include/c++/4.0.0/i686-apple-darwin8/"
ignoring nonexistent directory "/usr/include/c++/4.0.0/backward"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/boost_1_53_0
/usr/include/c++/4.2.1
/usr/include/c++/4.2.1/backward
/usr/local/include
/usr/bin/../lib/clang/4.1/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0
-o mpz1 /var/folders/hj/zc5pjqjd6gxgq2sw77xghkyh0000gn/T/mpz1-KE6NKq.o
-lstdc++
-lSystem /usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"___gmp_get_memory_functions", referenced from:
boost::multiprecision::backends::gmp_int::str(long,
std::_Ios_Fmtflags) const in mpz1-KE6NKq.o
"___gmpz_clear", referenced from:
boost::multiprecision::backends::gmp_int::~gmp_int() in mpz1-KE6NKq.o
"___gmpz_get_str", referenced from:
boost::multiprecision::backends::gmp_int::str(long,
std::_Ios_Fmtflags) const in mpz1-KE6NKq.o
"___gmpz_init", referenced from:
boost::multiprecision::backends::gmp_int::operator=(long) in
mpz1-KE6NKq.o
boost::multiprecision::backends::gmp_int::gmp_int() in mpz1-KE6NKq.o
"___gmpz_mul_ui", referenced from:
boost::multiprecision::backends::eval_multiply(boost::multiprecision::backends::gmp_int&,
unsigned long) in mpz1-KE6NKq.o
"___gmpz_set_si", referenced from:
boost::multiprecision::backends::gmp_int::operator=(long) in
mpz1-KE6NKq.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net