I am trying to get gmp working so I can use large integers. I've compiled it ok but when I try to compile my code with it I keep getting errors such as:
.../libgmp.so: undefined reference to `__gmpn_sublsh2_n'
My compile line is,
g++ -g -std=c++11 -I ../gmp-6.1.2 test.cpp -L../gmp-6.1.2/.libs -lgmp -lgmpxx
libgmpxx.so
is definitely in the specified lib directory.
I can't find any references to similar problems or any reference in the docs to dependencies for libgmp.so (shouldn't it be linking with libgmpxx.so?).
I'm sure I've missed something obvious and will feel the fool when someone points it out, but at the moment I'm losing it.
Thank you guys, I seem to have found the problem. You got me thinking about the location of libgmpxx.so. I copied it into /usr/local where I found libgmp.so and adjusted my library paths (-L) and hey presto! Clearly the undefined references are defined in libgmp.so upon which libgmpxx.so depends and could not find in the directory where it lived (.libs) or in the search path.
Thanks again.