Compiling Issue

Francesco Barbato barbafrank at
Sun Mar 9 15:06:24 UTC 2014

Good morning,

this is the second time I send this email, last time the attachments were lost.

i'm sorry if my english sucks, unfortunately is not my native language. 

When i try to compile my code i receive 2 errors from Xcode:

1. /Applications/ Object expression of non-scalar type '__mpz_struct [1]' cannot be used in a pseudo-destructor expression
2. /Applications/ Array 'new' cannot have initialization arguments

here is my code:

//  main.cpp
//  isPrime
//  Created by Francesco on 07/02/14.
//  Copyright (c) 2014 Francesco. All rights reserved.

#include <iostream>
#include <vector>
#include </usr/local/include/gmp.h>

bool isPrime(long n)
    bool flag = true;
    std::vector<mpz_t> row; row.resize(n/2+1);
    mpz_set_si(row[0], long(1));
    for(int i=1; i<n/2+1; i++)
    mpz_t resto;
    for(long i=1; i<(n/2+1); i++)
        if(mpz_get_si(resto) != 0)
            flag = false;
    return flag;

int main(int argc, const char * argv[])
    std::cout << "Inserisci il numero \n"; //it's italian 'cause i am italian
    long n;
    std::cin >> n;
    if(isPrime(n) == true)
        std::cout << "Il numero " << n << " é primo\n";
        std::cout << "Il numero " << n << " non é primo\n";
    return 0;

i'd like to know if is my fault, like if i made a mistake in my code, or is an error in your library.

thanks in advance,

Francesco Barbato

More information about the gmp-discuss mailing list