When calling __gmpz_set_str()
in a NS3, I got this error:
undefined reference to __gmpz_set_str
collect2: error: ld returned 1 exit status
I am already including #include <gmpxx.h>
and I have also installed libgmp3-dev
and libgmp-dev
.
Any idea? this is the link to the waf: https://github.com/nsnam/ns-3-dev-git/blob/master/waf and the link to the wscript: https://github.com/nsnam/ns-3-dev-git/blob/master/wscript
# This is the make file content:
#Makefile wrapper for waf
all:
./waf
#free free to change this part to suit your requirements
configure:
./waf configure --enable-examples --enable-tests
build:
./waf build
install:
./waf install
clean:
./waf clean
distclean:
./waf distclean
The compile flags need to be set at configure time, so the correct incantation is:
LDFLAGS=-lgmp ./waf configure
Now, you can simply run ./waf
to build the entire codebase, and the -lgmp
flag will be used. If you really want to use make(1), then
LDFLAGS=-lgmp make configure
should also work, but I recommend just using waf directly since it is the actual build system, not make.