[neutron-mc] Problem with `--no-runtime' option

Emmanuel Farhi farhi at ill.fr
Thu Apr 3 15:19:30 CEST 2003

Hello Timur,

The --no-runtime option for mcstas means that the 'standard'
library/tools for Monte Carlo are not embedded in the instrument source
code (.c). Anyway, most of the components require some of the functions
there-in. Thus, either you have to supply equivalents to the definitions
listed in mcstas-r.h (but this is probably not a good solution as it
requires a lot of work), or you have to link the libraries after the
creation of the .c. This is what I explain afterwards.
Thus, the right compilation process would be:
> mcstas  -t --no-runtime Laue_diff.instr
> gcc -c mcstas-r.c
The '-c' means 'just build the .o and do not link'.  This requires to
have access to mcstas-r.c and .h, either through copies (possibly
modified by you) or links.
If the symbol MCSTAS_VERSION is required, use: cc -c
-DMCSTAS_VERSION="External McStas run-time" mcstas-r.c
> gcc -o Laue_diff..out mcstas-r.o Laue_diff..c -lm
means, use the external mcstas-r object file, and link it

Good luck, Emmanuel.

Timur Elzhov wrote:

> Dear McStas experts!
> I tried to convert the example instrument file (considered
> in the manual) in the C file with '--no-runtime' option:
>   ~$  mcstas -t --no-runtime Laue_diff.instr
>   ~$
> That's OK. Then, I tried to compile this file (having links
> to 'mcstas-r.h' as well as 'mcstas-r.c' in the directory):
>   ~$  gcc -c Laue_diff.c
>   Laue_diff.c: In function `mcinit':
>   Laue_diff.c:613: `mcdotrace' undeclared (first use in this function)
>   Laue_diff.c:613: (Each undeclared identifier is reported only once
>   Laue_diff.c:613: for each function it appears in.)
>   Laue_diff.c: In function `mcraytrace':
>   Laue_diff.c:721: `mcdotrace' undeclared (first use in this function)
> Where am I wrong?  Thank you for any help!
> (I use the 1.5 version of McStas)
> --
> WBR,
> Timur V. Elzhov
> _______________________________________________
> neutron-mc mailing list
> neutron-mc at neutron.risoe.dk
> http://neutron.risoe.dk/mailman/listinfo/neutron-mc

What's up Doc ?
Emmanuel FARHI, http://www.ill.fr/tas/people/Farhi.html   \|/ ____ \|/
CS-Group ILL4/156, Institut Laue-Langevin (ILL) Grenoble  ~@-/ oO \-@~
6 rue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France  /_( \__/ )_\
Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 20 76 48     \__U_/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20030403/ed119c80/attachment.html>

More information about the mcstas-users mailing list