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

Emmanuel Farhi farhi at ill.fr
Thu Apr 3 18:08:54 CEST 2003


Hy Timur,

I finally realized what you mean. I corrected a few declaration mismatches
that probably date from a long time, and only apply when using the
--no-runtime.
For your particular case, you should probably add in mcstas-r.h lines such as

     extern int mcdotrace;

the type of the missing variables to declare is to be found in mcstas-r.c (and
should be preceeded by 'mcstatic' in this latter file).

Emmanuel.

Timur Elzhov wrote:

> On Thu, Apr 03, 2003 at 03:19:30PM +0200, Emmanuel Farhi wrote:
>
> > 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.
> Hmm, let's look at the my text more thoroughly:
>  TE>   ~$  gcc -c Laue_diff.c
>              ^^^^^
> I just try to create the *object* file Laue_diff.o only,
> *without* linking! The compiler goes through this step
> inevitably, right? ;)
>
> Well, we note that mcstas-r.h is in our directory...
>
> Now, let's compile them.  gcc fails with errors:
>  TE>   Laue_diff.c: In function `mcinit':
>  TE>   Laue_diff.c:613: `mcdotrace' undeclared (first use in this function)
>  TE>   Laue_diff.c:613: (Each undeclared identifier is reported only once
>  TE>   Laue_diff.c:613: for each function it appears in.)
>  TE>   Laue_diff.c: In function `mcraytrace':
>  TE>   Laue_diff.c:721: `mcdotrace' undeclared (first use in this function)
>
> `-DMCSTAS_VERSION="External McStas run-time"' doesn't help :(
>
> > If the symbol MCSTAS_VERSION is required, use: cc -c
> > -DMCSTAS_VERSION="External McStas run-time" mcstas-r.c
> > Then:
> > > gcc -o Laue_diff.out mcstas-r.o Laue_diff.c -lm
> > means, use the external mcstas-r object file, and link it
> This produces absolutely the same errors :-(
>
> Where am I wrong, again?
> Sorry if I so stupid!  ;-)
>
> --
> WBR,
> Timur.
>
> _______________________________________________
> 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/feca5f3d/attachment.html>


More information about the mcstas-users mailing list