GMP Library Issue



I don't where to post this so kindly forgive me for posting on this
forum. I have create a mpz_t array and i want to sort this. Using c++
sort function generates lot of errors and i searched on net but did
not get anything useful. Kindly tell me how to sort the array.
#include<cstdio>
#include<iostream>
#include<gmp.h>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
mpz_t ret_1;
int v[42];
mpz_t v_l[2097160],v_r[2097160];
void _prime()
{
bool p[190];
memset(p,0,sizeof p);
for(int i=2;i*i<190;i++)
if(!p[i]) for(int j=i*i;j<190;j+=i) p[j]=1;
int cnt=0;
for(int i=2;i<190;i++) if(!p[i])cout<<i<<" ",v[cnt++]=i;
cout<<endl<<cnt<<endl;
mpz_add_ui(ret_1,ret_1,1);//ret_1=1;
for(int i=0;i<cnt;i++) mpz_mul_ui(ret_1,ret_1,v[i]);
gmp_printf("%Zd\n",ret_1);
}
int main()
{
_prime();
//i have generated prime
mpz_t t_1,t_2;
int cnt=0;
for(int i=0;i<(1<<21);i++)
{
mpz_init(t_1),mpz_init(t_2);
mpz_add_ui(t_1,t_1,1),mpz_add_ui(t_2,t_2,1);
for(int j=0;j<21;j++)
if(i&(1<<j))mpz_mul_ui(t_1,t_1,v[j]),mpz_mul_ui(t_2,t_2,v[j+21]);
mpz_set(v_l[cnt],t_1);
mpz_set(v_r[cnt],t_2);
cnt++;
}
printf("%d\n",cnt);
for(int i=100000;i<100010;i++) gmp_printf("%Zd %Zd
\n",v_l[i],v_r[i]);
//sort(v_l,v_l+cnt);//creates error

}
.