I'm a bit of a newbie and I ran into some issues using gmp with boost.
You need to add -lgmp to the end of your command line, and probably an -L option before that to point to the directory containing the gmp library files - please see the GCC manual for information on those options. HTH, John.
After building gmp-5.1.2, I tried to build a simple file: boostMathExample.cpp, based on the documentation (using the multiprecision library + referencing gmp):
////////////////////////////////////////// #include
using namespace boost::multiprecision;
int main(int argc, const char *argv[]) { mpz_int v = 1;
// Do some arithmetic: for (unsigned int i = 1; i <= 1000; ++i) v *= i;
std::cout << v << std::endl; } ///////////////////////////////////////////////
I received the following missing symbol errors when trying to build:
g++ -I ~/Dev/C++/gmp-5.1.2 -I ~/Dev/C++/boost boostMathExample.cpp -O2 -o boostMathExample
Undefined symbols: "_main", referenced from: start in crt1.10.6.o "___gmpz_init", referenced from: __static_initialization_and_destruction_0(int, int)in cccOFSnR.o __static_initialization_and_destruction_0(int, int)in cccOFSnR.o "___gmpz_clear", referenced from: ___tcf_1 in cccOFSnR.o __static_initialization_and_destruction_0(int, int)in cccOFSnR.o "___gmpz_set_si", referenced from: __static_initialization_and_destruction_0(int, int)in cccOFSnR.o ld: symbol(s) not found collect2: ld returned 1 exit status
======================================== I'm running the following version of g++: i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
I configured gmp, version 5.1.2 with the following flags: ./configure --enable-cxx CXX=g++ CXXFLAGS=-O2 CC=g++ CFLAGS="-g -O2" and then ran "make" and "make check".
Any insight would be appreciated.
Thanks, Fred
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost