We tried compiling a code - multiply1.c in the Linux environment
by giving the command gcc multiply1.c (we have renamed it) but its throwing
errors like :-
In function "main": undefined reference to '_gmpz_init_set_str'
We are getting 6 to 7 this type of errors.

Can you please let us know how to compile your code in Linux environment.

9 Years
Discussion Span
Last Post by aamresh1

I assume you're including headers from the gnu multiple precision library?

If so you need to tell the linker the name of the library.. e.g.

gcc multiply1.c -lgmp

If that doesn't work.. make sure you have the library installed and in one of the "normal" library directories.. If it's not in one of the normal directories:

gcc multiply1.c -lgmp -L/directory/name/here

Please post all of the "undefined reference" errors.

Did you get a different error when you tried with -lgmp?

You are using GMP, yes?

If so, did you compile GMP yourself, or use a packaged version?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.