Hi,
Basic lack of knowledge problem I installed gmp on my Raspberry pi and am having trouble getting an executable. Here's what I've done....
Raspberry pi install and test of gmp
1) Downloaded gmp-6.2.1.tar.xz
2) Extracted files to ~/source/c++/gmp-6.2.1
3) installed m4
4) ran ./configure -enable-cxx
5) make
6) sudo make install
7) make check (22 test ran, 22 test passed
- no errors, no skip, no xfail, no fail, no xpass)
directory structure
~/source|
|- c++
|- gmp-6.2.1 (contains gmp.h, libgmp.la, and libgmpxx.la)
|- gmp_test1
In gmp_test1
g++ -c gmp_test1.cpp -lgmp
compiles with no errors displayed
g++ gmp_test1.o
messages
error: ld returned 1 exit status
get messages like
undefined reference to `__gmpz_init'
Seems like a path problem to the gmp-6.2.1 directory, but gosh
darn can I find this simple error/omission. What am I omitting/doing wrong etc.?
Where's a good place to read up on this? (Been a long time since my C++ days with OS/2.)
Code - copied from some poor soul on the web
1 2 3 4 5 6 7 8 9 10 11 12 13
|
using namespace std;
int main()
{
mpz_class a,b,c;
a = 1234;
b = "-5678";
c = a + b;
cout << "sum is " << c << endl;
cout << "absolute value is " << abs(c) << endl;
return 0;
}
|