Dynamic array allocation fails

Alessio Rocchi alexrocchi at gmail.com
Tue Dec 6 20:16:58 CET 2005


Hi everybody.
I'm experiencing a problem with dynamic allocation of mpz_t arrays.
I write code like following:

#include "gmp.h"
typedef struct{
        mpz_t *FacBase;
        int FacBaseSize;        
}FattoreBase;
int main (void){

    FattoreBase     FactorBase; 
    int  FactorBase.FacBaseSize=255; //it could change...
    mpz_array_init(FactorBase.FacBase, FactorBase.FacBaseSize, 32);
    return 0;
}

At compile time, compiler stops with the following error message:

main.cpp cannot convert `__mpz_struct (*)[1]' to `__mpz_struct*' for argument `1' to `void __gmpz_array_init(__mpz_struct*, mp_size_t, mp_size_t)

I really can't understand what's the problem.
Could anyone help me?
Thank you,
Alessio

P.S.: I'm developing on Windows Xp Pro, Including lib-gmp3.a (generated by building GMP with Mingw and Msys). Development environment Dev C++. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gmplib.org/list-archives/gmp-discuss/attachments/20051207/e3487b78/attachment.html


More information about the gmp-discuss mailing list