#include <iostream>
#include <cmath>
#include <new>
using namespace std;
struct vector
{
double x,y,z;
};
struct ivector
{
int ix,iy,iz;
};
struct vmodel
{
int nx,ny,nz; //grid dimensions
int nr; //number of reflectors
struct vector r1,r2; //2 corners of the spanning model
float dx,dy,dz;
float s1_size,rf_size,jp_size,ir_size,ij_size,layer_size;
// dynamic arrays being declared here
float *s1=new float[s1_size];
float *rf=new float[rf_size];
float *jp=new float[jp_size];
int *ir=new int[ir_size];
int *ij=new int[ij_size];
int *layer=new int[layer_size];
};
Hi,
this is just code and I cannot understand what the actual issue is and how it occurs, with which ROOT version on which platform.
Nevertheless, a piece of advice I can give is
- never use statements such as “using namespace XYZ” in header files (I assume the snippet above is a header)
- do not create entities with the same name of the stl ones in the global namespace, especially after using a “using namespace std” declaration
Cheers,
D
Hi,
The compiler tells you (in its own delightful colorful way) that one cannot create a dynamic array whose size is a floating point value.
Either declare the s1_size,etc variable as e.g. int or convert them to e.g. int when declaring the arrays.
hth,
-s
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.