Compiling mcstas for windows, and bug fix for mc2d

PILTZ, Ross rop at ansto.gov.au
Mon Feb 26 08:37:57 CET 2001


Dear MCSTASers,

For those using the free Borland compiler for windows I have made an instruction
file mcstas_windows.txt on how to compile McStas.  If you have already followed
my instructions in borland_glui.zip on how to setup the compiler you will find it
doesn't compile McStas properly, that is, McStas cannot find the component
library.  This is due to some missing definitions in the borland configuration files.
The new borland_glui.zip and mcstas_windows.txt sent to the upload area have
corrected these mistakes.  I have appended mcstas_windows.txt to the end of
this message.

The mc2d program miscounted the number of monitors in a simulation, resulting
in the last monitor being ignored.  So if you tried it out and only had one monitor
you would just get a message about no monitors found and the program would
crash/stop. I have now sent a fix for this bug to the upload area.  You need to
download mc3d.zip and (possibly) mc3d_exes.zip for these fixes.

-Ross Piltz

PS:  I will now be able to maintain mc3d/mc2d as I have become permanent
       at ANSTO.
===========================================================
Instructions for compiling and running McStas on Windows using the
free command-line C++ compiler from Borland (INPRISE).  -Ross Piltz

NB:  If you downloaded my instructions on how to make GLUI using
     the Borland compiler before 26-Feb-01 then you will be missing
     the "-D_WIN32" and "-DWIN32" lines in the bcc32.cfg file.
     If so, change bcc32.cfg to that indicated below.


INSTALLING THE BORLAND COMPILER

First, download the free compiler from www.borland.com.

I assume in the following that you install it to the
default directory of C:\BORLAND\BCC55.

With an editor make the following "bcc32.cfg" file:
-D_BORLAND
-D_WIN32
-DWIN32
-IC:\BORLAND\BCC55\INCLUDE
-LC:\BORLAND\BCC55\LIB

and "ilink32.cfg" file:
-LC:\BORLAND\BCC55\INCLUDE

and put the files in the C:\BORLAND\BCC55\BIN directory.  Don't
take Borland's advice of putting the *.CFG in your working directory
unless you want to have different configurations in every directory.

Edit C:\AUTOEXEC.BAT inserting the line:
PATH=%PATH%;C:\BORLAND\BCC55\BIN

Next restart your PC and try typing the MSDOS command
BCC32 | MORE
You should get a page of stuff about compiler options, and the
version number of the compiler at the top of the page.
(The version I have is Borland C++ v5.5.1)


COMPILING MCSTAS

The following will compile mcstas assuming the default directory
location of the component library is C:\MCSTAS\LIB.

  bcc32 -w- -emcstas -DHAVE_FDOPEN instrument.tab.c lex.yy.c debug.c
memory.c list.c symtab.c coords.c rotation.c cexp.c position.c file.c cogen.c 

If you want to put the components in another directory you should compile
the above but using the following switch (NB: \\ means \ in a string)

  -DMC_SYS_DIR="C:\\some_directory\\lib"

Then copy mcstas.exe to a directory in your path like
c:\windows or c:\windows\command, or add a new directory to the
PATH command in your AUTOEXEC.BAT file.


COMPILING SIMULATIONS

Use MCSTAS to compile your *.instr file and make a *.c file.
  mcstas my_simulation.instr
 
Compile the *.c file using:
  bcc32 -w- my_simulation.c

NB: The -w- switch turns off the compiler warnings, otherwise you
    will get LOTS of warning about unused variables, and the compiler
    will give up due to "Too many warning or error messages".

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


More information about the mcstas-users mailing list