void -> char cast
Marc Glisse
marc.glisse at inria.fr
Sun Jan 12 14:58:27 UTC 2014
On Sun, 12 Jan 2014, Conor Williams wrote:
> g++ m9.7.7.C -std=c++0x -I/home/will51/LPS!/lpsb/gmp-5.1.3
> -L/home/will51/lib -o 9.7.7++ -I/home/will51/include -DHAVE_STDARG -O2
> -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -lexpr -lgmp
> -D_NUMBER_LOGGING_
> /home/will51/tmp/cceXyum4.o: In function `main':
> m9.7.7.C:(.text+0x283): undefined reference to `mpz_expr(__mpz_struct*,
> int, char const*, ...)'
> m9.7.7.C:(.text+0x418): undefined reference to `mpz_expr(__mpz_struct*,
> int, char const*, ...)'
> m9.7.7.C:(.text+0x447): undefined reference to `mpz_expr(__mpz_struct*,
> int, char const*, ...)'
> m9.7.7.C:(.text+0x583): undefined reference to `mpz_expr(__mpz_struct*,
> int, char const*, ...)'
> m9.7.7.C:(.text+0x830): undefined reference to `mpz_expr(__mpz_struct*,
> int, char const*, ...)'
> collect2: ld returned 1 exit status
> make: *** [all] Error 1
>
> when i re-link with g++ compied libs there are no errors...
> this is with and with the 'exten "C"...'
Ah, now I understand what you are doing (it would have helped to say more
from the beginning). You are compiling the demo libexpr, then using it in
a C++ program. But the header expr.h hasn't been made C++-safe. Using
Steve's extern "C" advice on the file expr.h (not gmp.h) would indeed have
solved this issue for you.
We don't promise much for the demo, but I'll add extern "C" in the header,
that's harmless.
--
Marc Glisse
More information about the gmp-bugs
mailing list