errors gsl librabry and lhapdf functions ; lhapf xfx(x,Q^2,#f) used oustide the main()

Asked by sujata

I have to integrate over x using Monte Carlo miser a function which returns the xfx(x,Q^2,#f) for various values of Qs.

I have defined a function something like:
#include <math.h>
#include "LHAPDF/LHAPDF.h"
#include <iterator>
#include <iostream>
#include <cstdlib>
using namespace std;

#include <iomanip>
#include <fstream>

#include <gsl/gsl_math.h>
#include <gsl/gsl_monte.h>
#include <gsl/gsl_monte_miser.h>

double g(double *x, size_t dim, double *par)
{
 struct my_f_params * fp = (struct my_f_params *)par;

double mz=91.1;
double Q=fp->a*fp->b*2*x[0];
double A=6*10**-39*fp->a*mz**4/(mz**2+2*fp->a*x[0]*fp->b)**2;
double B=A*(LHAPDF::xfx(x[0], Q, 1)+LHAPDF::xfx(x[0], Q, 2));
 return B;
}
But I am getting loads of errors:
sa.C: In function ‘double g(double*, size_t, double*)’:
sa.C:31:12: error: invalid use of incomplete type ‘struct g(double*, size_t, double*)::my_f_params’
 double Q=fp->a*fp->b*2*x[0];
            ^
sa.C:28:9: error: forward declaration of ‘struct g(double*, size_t, double*)::my_f_params’
  struct my_f_params * fp = (struct my_f_params *)par;
         ^
sa.C:31:18: error: invalid use of incomplete type ‘struct g(double*, size_t, double*)::my_f_params’
 double Q=fp->a*fp->b*2*x[0];
sa.C:28:9: error: forward declaration of ‘struct g(double*, size_t, double*)::my_f_params’
  struct my_f_params * fp = (struct my_f_params *)par;
         ^
sa.C:32:17: error: invalid type argument of unary ‘*’ (have ‘int’)
 double A=6*10**-39*fp->a*mz**4/(mz**2+2*fp->a*x[0]*fp->b)**2;
                 ^
sa.C:32:22: error: invalid use of incomplete type ‘struct g(double*, size_t, double*)::my_f_params’
 double A=6*10**-39*fp->a*mz**4/(mz**2+2*fp->a*x[0]*fp->b)**2;
                      ^
sa.C:28:9: error: forward declaration of ‘struct g(double*, size_t, double*)::my_f_params’
  struct my_f_params * fp = (struct my_f_params *)par;
         ^
sa.C:32:30: error: invalid type argument of unary ‘*’ (have ‘int’)
 double A=6*10**-39*fp->a*mz**4/(mz**2+2*fp->a*x[0]*fp->b)**2;
                              ^
sa.C:32:37: error: invalid type argument of unary ‘*’ (have ‘int’)
 double A=6*10**-39*fp->a*mz**4/(mz**2+2*fp->a*x[0]*fp->b)**2;
                                     ^
sa.C:32:43: error: invalid use of incomplete type ‘struct g(double*, size_t, double*)::my_f_params’
 double A=6*10**-39*fp->a*mz**4/(mz**2+2*fp->a*x[0]*fp->b)**2;
                                           ^
sa.C:28:9: error: forward declaration of ‘struct g(double*, size_t, double*)::my_f_params’
  struct my_f_params * fp = (struct my_f_params *)par;
a.C:32:54: error: invalid use of incomplete type ‘struct g(double*, size_t, double*)::my_f_params’
 double A=6*10**-39*fp->a*mz**4/(mz**2+2*fp->a*x[0]*fp->b)**2;
                                                      ^
sa.C:28:9: error: forward declaration of ‘struct g(double*, size_t, double*)::my_f_params’
  struct my_f_para
struct my_f_params * fp = (struct my_f_params *)par;
         ^
sa.C:32:60: error: invalid type argument of unary ‘*’ (have ‘int’)
 double A=6*10**-39*fp->a*mz**4/(mz**2+2*fp->a*x[0]*fp->b)**2;
                                                            ^
I an mew to coding. So please help.
         ^

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu lhapdf Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.