I have a code in C++ called source.cpp. And I have a library in C. I use Cygwin and run: g++ source.cpp -L/cygdrive/c/cygwin/home/Win7/libpaillier -l:libpaillier.a -lgmpxx -lgmp to create an .exe file and then run it. At the end I get " segmentation fault (core dumped)". I need to know why I'm getting this error.
Source.cpp:
#include<iostream>
#include<gmp.h>
#include <gmpxx.h>
using namespace std;
#include <string>
extern "C"{
#include<paillier.h>
}
#include<math.h>
#include <stdio.h>
#include <stdlib.h>
int main(){
paillier_pubkey_t* pu;//The public key
paillier_prvkey_t* pr;//The private key
paillier_get_rand_t get_rand;
paillier_keygen(1024, &pu,&pr, get_rand );
return 0;
}
Paillier library: http://acsc.cs.utexas.edu/libpaillier/