compilation error, missing headers


Hi everyone

I need help ! I am going to use the GNU Multiple Precision Arithmetic Library ( http://gmplib.org/ ) and its C++ class interface. I'm using ubuntu 9.10 , g++4.4 , and a bash terminal. I installed GNU MP following the instructions on the manual http://gmplib.org/manual/ :
download and unzip and then
./configure --enable-cxx
make
make check

(I didn't make install because I have no superuser privileges.) but anyway the libraries I need ( gmpxx.h and gmp.h ) are in the directory where I installed.

According to the documentation, All the C++ classes and functions are available with #include <gmpxx.h>, and the programs should be linked with the ‘libgmpxx’ and ‘libgmp’ libraries:

g++ mycxxprog.cpp -lgmpxx -lgmp

but the output gives me this:

/usr/bin/ld: cannot find -lgmpxx
collect2: ld returned 1 exit status

I already have append the lines
export CPLUS_INCLUDE_PATH="/home/yo/Documents/gmp/gmp-4.3.2"
export LIBRARY_PATH="/home/yo/Documents/gmp/gmp-4.3.2"
to my ./bashrc file, but they have no effect.

any suggestion would be greatly appreciated

thanks
If you want to install this (or anything) into your home directory you can re-configure it like this


./configure --enable-cxx --prefix=$HOME/gmplib


Then when you do 'make install' you won't need root privileges and everything will get installed into the directory 'gmplib' in your home directory.

Then to compile use

g++ mycxxprog.cpp -I$HOME/gmplib/include -L/$HOME/gmplib/lib -lgmpxx -lgmp


In order to run the linked program you will need to set the variable LD_LIBRARY_PATH like this:


export LD_LIBRARY_PATH=$HOME/gmplib/lib:$LD_LIBRARY_PATH

Last edited on
Topic archived. No new replies allowed.