Problem with 4 dimensional array

Hi,

I am having compilation error when I declare a 4-dimensional array in header file:

double someFun(double A[4][7][8][2]).

Upto 3-dim is fine.

The error is

Cint internal error ary parameter dimension :0:
Warning: Error occurred during dictionary source generation

I am using root5.22.
Any idea will be appreciated.

Hi,

This is indeed a limitation of CINT, to work around the problem you will need to compile your script (for example with ACLiC: .L myscript.C+) and you also might have to hide this function from CINT for surrounding it with:#ifndef __CINT__ double someFun(double A[4][7][8][2]) { .... } #endif
Cheers,
Philippe.

Thanks, it works.

[quote=“pcanal”]Hi,

This is indeed a limitation of CINT, to work around the problem you will need to compile your script (for example with ACLiC: .L myscript.C+) and you also might have to hide this function from CINT for surrounding it with:#ifndef __CINT__ double someFun(double A[4][7][8][2]) { .... } #endif
Cheers,
Philippe.[/quote]

hi,

root[0].L myscript.C+ works well, but gmake -f Makefile shows [quote]Error: link requested for unknown function someFun LinkDef.h:6:
[/quote]

yjc

Hi,

What is the rootcint command line you used? You may have omitted a few of the necessary header files?

Philippe.

[quote=“pcanal”]Hi,

What is the rootcint command line you used? You may have omitted a few of the necessary header files?

Philippe.[/quote]
I change double A[4][7][8][2] to double A[4][7][16], and use it as A[4][7][i*2] and A[4][7][i*2+1], i=0:7 . it also works with Makefile

This is the Makefile(assuming you mean there are more header files needed in this file, if I want to use 4d array) that I use to generate .so file.

[code]SOURCES = comp3exts.C ftri.C gfis.C
HEADERS = comp3exts.h ftri.h gfis.h
FLAGS = -O -Wall -fPIC root-config --cflags root-config --ldflags
GLIBS = root-config --glibs
INC = -Iroot-config --incdir

suffix rule

.cc.o:
g++ -c $(CXXFLAGS) $(GDBFLAGS) $<

define the final target

all: libName.so

libName_dict.C: $(HEADERS) LinkDef.h
rootcint -f $@ -c -g $^

libName.so: libName_dict.C $(SOURCES)
g++ -shared -o $@ $(FLAGS) $(GLIBS) -g $(INC) $^

#cleaning
rm -fr *_dict.?
[/code]

Thank you.
yjc

[quote] change double A[4][7][8][2] to double A[4][7][16], and use it as A[4][7][i*2] and A[4][7][i*2+1], i=0:7 . it also works with Makefile[/quote]Fair enough. Then you are all set.

Cheers,
Philippe.

[quote=“pcanal”][quote] change double A[4][7][8][2] to double A[4][7][16], and use it as A[4][7][i*2] and A[4][7][i*2+1], i=0:7 . it also works with Makefile[/quote]Fair enough. Then you are all set.

Cheers,
Philippe.[/quote]

8) I just hope I would not get the chance to code 5d, 6d, or Nd arrays in my code.

Have a nice weekend.

yjc