[mcstas-users] question about array-lib.c and .h

Peter Kjær Willendrup pkwi at fysik.dtu.dk
Thu Mar 12 20:27:56 CET 2020

Dear Santiago,

Thanks for reporting this, which seems to be a proper bug in 2.6, sorry about this.

I have created a GitHub issue (https://github.com/McStasMcXtrace/McCode/issues/993) so that this is fixed before releasing the next McStas 2.x.

For most of our code I believe gcc 4.7.7 should be just fine. If you want an overview of what works and not, try either

1) Our new test-tool, mctest.py / mcviewtest.py - can be found on the mcstas-3.0 branch: https://github.com/McStasMcXtrace/McCode/tree/mcstas-3.0/tools/Python/mctest. Proper docs for these tools are stil to be written.

2) Our legacy test system, mcrun.pl --test

For comparison, our daily test output toward McStas 3.0 can be found at http://new-nightly.mccode.org. The html-tables in the subfolders indicate “McStas 2.5” but what is tested in that column is in fact the “master” branch.

Best and greetings from a Corona-shutdown DK,


On 12 Mar 2020, at 18.44, Santiago Gómez <sgomez at cab.cnea.gov.ar<mailto:sgomez at cab.cnea.gov.ar>> wrote:

Hello, when I compile the example instrument templateSANS.instr with
mcstas 2.6 and gcc 4.4.7 I get this issue

PSD_monitor.comp:76: error: redefinition of typedef 'DArray1d'
PSD_monitor.comp:60: note: previous declaration of 'DArray1d' was here
PSD_monitor.comp:77: error: redefinition of typedef 'DArray2d'
PSD_monitor.comp:64: note: previous declaration of 'DArray2d' was here
PSD_monitor.comp:78: error: redefinition of typedef 'DArray3d'
PSD_monitor.comp:68: note: previous declaration of 'DArray3d' was here

This example compiles well with other gcc compiler (version 4.8.3).

I see at the mcstas pre-compiled file templateSANS.c that the next
typedef definitions appear twice, so this is the redefinition error for
compiler gcc 4.4.7.

typedef double* DArray1d;
typedef double** DArray2d;
typedef double*** DArray3d;

I simply commented those typedef definitions at array-lib. c, because
they are already present in the array-lib. h, and it works ok, at least
I have checked the output values from both compilers and the match ok.

Should I check other things to keep this solution to use compiler 4.4.7?
(this compiler is in a cluster and it is difficult to change version)

With best regards,


Santiago Miguel Gómez
Departamento de Física de Reactores y Radiaciones
Centro Atómico Bariloche
Int.: 5971

"Si queremos un mundo de paz y de justicia hay que poner decididamente la inteligencia al servicio del amor." Antoine de Saint-Exupery

mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>

Peter Kjær Willendrup
Forskningsingeniør, Specialkonsulent
Næstformand for DTU Fysik LSU

DTU Physics

[cid:b6339554-7f28-441d-9f31-5944f811397c at win.dtu.dk]

Technical University of Denmark

[cid:e108e480-fcab-46e2-9531-b38165079572 at win.dtu.dk]

Department of Physics
Building 307
DK-2800 Kongens Lyngby
Direct +45 2125 4612
Mobil +45 2125 4612
Fax +45 4593 2399
pkwi at fysik.dtu.dk<mailto:pkwi at fysik.dtu.dk>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20200312/2392a81c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 58 bytes
Desc: image001.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20200312/2392a81c/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 1055 bytes
Desc: image002.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20200312/2392a81c/attachment-0003.gif>

More information about the mcstas-users mailing list