Re: error: ‘mpz_inits’ was not declared in this scope

Creatxr creatxr at gmail.com
Mon Sep 19 19:54:52 CEST 2011


now i downloaded and installed the new version of gmp.
i run "install check" also, it has no error.
but it has still problem wlhile comiple:
===========================
/cpp-test/main.cpp|37|undefined reference to `__gmpz_inits'|
===========================
mpz_init() works. mpz_inits() still not.



On Mon, Sep 19, 2011 at 1:00 PM, David Gillies <daggillies at gmail.com> wrote:
> I didn't even know there was an mpz_inits function. Maybe I should
> read the latest manual. Or maybe you should.
>
> On Mon, Sep 19, 2011 at 9:58 AM, Creatxr <creatxr at gmail.com> wrote:
>> Hi,
>> It's my first time to use GMP library.
>> What's happened with this code?
>> thanks.
>> =============================================
>> /main.cpp|11|error: ‘mpz_inits’ was not declared in this scope|
>> /main.cpp|13|error: ‘mpz_clears’ was not declared in this scope|
>> =============================================
>> #include <iostream>
>> #include <gmp.h>
>>
>> using namespace std;
>>
>> void mpz_inverseMod(mpz_t r, mpz_t n, mpz_t m) {
>>    mpz_t x1, x2, x3;
>>    mpz_t y1, y2, y3;
>>
>>    mpz_init(x1);
>> //-------------------------------------above is correct
>>    mpz_inits(x1, x2, x3, y1, y2, y3);
>>
>>    mpz_clears(x1, x2, x3, y1, y2, y3);
>> }
>>
>> int main()
>> {
>>    cout << "Hello world!" << endl;
>>    return 0;
>> }
>> _______________________________________________
>> gmp-discuss mailing list
>> gmp-discuss at gmplib.org
>> https://gmplib.org/mailman/listinfo/gmp-discuss
>>
>
>
>
> --
> David Gillies
> San Jose
> Costa Rica
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
>


More information about the gmp-discuss mailing list