Silverfrost Forums

Welcome to our forums

how do i create the executable when compiling?

24 Sep 2012 10:10 #10753

I am attempting to compile a f77 code based optimization program called MINOS. First, when I compile the various subroutines, I get alot of warning messages about a variable being declared but not used. Second, when I go to run the program, I get a message about a particular subroutine not able to be located. Third,is there a command I need to use to link all the object code files, or does Plato do that automatically?

25 Sep 2012 6:34 #10757

Warning messages can be ignored. You will need to find the code for the missing routine. Plato will do the linking for you if you click on the appropriate button on the toolbar.

27 Sep 2012 7:02 #10773

Plato is doing good job but I still compile via batch file.

Will show how i do that and of course i'm ready to learn from all you too. This is old good method where you do not need to remember what and how it was done and requires you ultimately only one single doubleclick or one single ENTER to compile everything. All is self-documented because batch file language is simplest of all languages. This worked 30 years ago, works today and hopefully will work forever.

First, having Total Commander (resembling famous Norton Commander, the free program on the net) is important here for ultimate convenience of working with all files. That is #1 program i install on new OS.

Let's call batch file COMPILING.BAT. Then when you press 'Ctrl+Enter n' stepping on the file COMPILING.BAT, the command line will be automatically filled and run

X> COMPILING n

You just type one letter 'n' or nothing and use cursor keys, no excessive typing necessary -- why i also like this method.

The batch file may use external parameter for example 'n' or 'N' and 's' or 'S' to direct the compilation with /check ( or /nocheck) and with SDBG debugger or without it. Here are two examples what's inside of batch files.

if (%1)==(n)     goto nocheck
if (%1)==(N)     goto nocheck

del e.exe
ftn95 E.f95 /debug  /undef /check /free  >e00001
slink e.obj /stack:3000000 >e00002

if (%1)==(s)     goto sdbg
if (%1)==(S)     goto sdbg
e.exe
goto end

:sdbg
sdbg e.exe
goto end

:nocheck
del e.exe
ftn95 E.f95 /nocheck /free   >e00001
slink e.obj /stack:3000000 >e00002
e.exe
goto end

:end

Compilation errors are gathered in the files e00001 and linking errors in e00002

That was hardware type of programming where everything is set in advance and you just chose the path there. Another example uses one more external batch parameter %2 to to follow the same stream of compilation for all options and just tell compiler how to compile more verbose way with /nocheck, /check or /undef or millions others ways. Here several related programs are compiled (like 10 but shown 2) and if you need to recompile just one of them the first batch parameter is used. For example

X> COMPILING a u

will compile only ANGULAR program with checking of all undefined variables ( /checkmate)

If no external parameters used - all programs will be compiled consequently some standard way you decide. You can set also only linking without compilation etc etc etc.

if (%2)==(n)  set s1=/nocheck /zeroise /statistics 
if (%2)==(f)  set s1=/full_debug /check /zeroise /statistics 
if (%2)==(u)  set s1=/full_debug /checkmate /zeroise 

if (%1)==(a)    goto ANG
if (%1)==(an)   goto ANG
if (%1)==(ang)  goto ANG
if (%1)==(s)    goto SPAT
if (%1)==(sp)   goto SPAT

rem ---------------- compiling Angular
:ANG
ftn95  AngularM.for     %s1%   
ftn95  AngularN.for     %s1%   
ftn95  Angg.for   %s1%  
slink AngularM.obj AngularN.obj Angg.obj >c0002A
if (%1)==(a)   goto END
if (%1)==(an)  goto END
if (%1)==(ang) goto END

rem ---------------- compiling Spatial
:SPAT
ftn95  SpatialA.for       %s1% 
ftn95  SpatialB.for       %s1% 
ftn95  SpatialC.for       %s1% 
ftn95  SpatialD.for       %s1% 
slink SpatialA.obj SpatialB.obj SpatialC.obj SpatialD.obj >c0002S
if (%1)==(s)   goto END
if (%1)==(sp)  goto END

rem ---------------- compiling other stuff
:CCC
rem ...

rem ---------------- Linking only, no compilation
:LINK
rem ...

rem ---------------- Linking only with another options, no compilation
:LINK2
rem ...



:END
Please login to reply.