Monday, March 23, 2009

QB45 Batch Compiles

The last couple posts have been about using Crimson Editor as a QB45 programming environment. I've run into a problem. Different QB programs require different command-line options to compile. For instance, when I try to compile an example program named CRLF.BAS, Crimson gives me the following output:
---------------------------------------------
0084 0012 ON ERROR GOTO ErrorHandler ' Turn on error trapping.
^ Missing On Error (/E) option
00A9 001A ON ERROR GOTO 0 ' Turn off error trapping.
^ Missing On Error (/E) option
0278 002A RESUME
^ Missing Resume Next (/X) option
02A0 002E RESUME
^ Missing Resume Next (/X) option
02B6 002E ON ERROR GOTO 0
^ Missing On Error (/E) option
---------------------------------------------

This is because the default makefile generated by Crimson Editor the way I have it set up now is missing two command-line options that are needed to make it compile.

So, when you come to a QB project like this, what do you do? I could write a separate utility to help choose command-line options (I'll probably get around to it some day). You could give up Crimson and open the project in QB. OR you could write a simple batch file. The same code that produced the errors above can be compiled by running this code as a batch file in the CRLF.BAS folder:
---------------------------------------------
call C:\QBasic\BC.EXE CRLF.bas /E/X/o;

call C:\QBasic\LINK.EXE CRLF.obj, scratch\CRLF2.exe, , C:\QBasic\BCOM45.LIB ;

---------------------------------------------

Now CRFL.BAS will compile with three command-line options and run perfectly. I even changed the output folder and the name of the output file.

No comments: