Home Why Omnibasic Features FAQ Examples
Reviews Keyword/Syntax On-Line Manual Download Manual ScreenShots

Chapter 6

Using the Compiler

Once the program is written using the IDE editor, the program is ready to be compiled. This is accomplished by invoking the compiler. The IDE automatically determines if you want to compile a console application or a graphical application based upon what mode you are using the IDE in. All that you need to do to compile your program is to press the Compile Project button on the button bar of the IDE. The compiler will compile the program and create the executable program and place it in the main OmniBasic directory. If you want to do a test compile, you can press the test compile button on the button bar of the IDE. You can optionally use the command line mode to compile a program as well. The syntax for that follows:

For a console application

ob FileName.b {opts} {CompVar=Const...}

For a graphical application

Ob FileName.bw {opts} {CompVar=Const…}

The compiler is called ‘ob’ and is normally found in the OmniBasic base directory.

If no options are given, OmniBasic will compile the source (.b or bw) file into an executable program. This sequence of events may be modified or enhanced by the use of command line options.

The options (opts) are as follows:

  • t - Compile with no output but check for errors. This is useful at various stages of program development. It allows the programmer to passively check for certain errors.
  • s - Symbol table dump to stdout·
  • d - Disable Auto-Diminsion feature
  • p - Wait for user to hit ENTER after compile (useful for editors that launch OmniBasic).
  • ? - Display options
  • w - Create windows executable (some versions).

When you compile if any errors occur then the IDE will display them on the Compile window. In the following example the programmer forgot to give a length to the B string variable that he created. This program was created using the IDE and each section that has a heading would show up in the Editor as a separate module. The #USE OBDefs DEF inserts into the program all of the standard OmniBasic defined constants. In the Declarations, the programmer left the * 20 off of the STRING declaration.

DIM A AS LONG
DIM B AS STRING

 ******** Construct Objects ********

************ OBMain ************

OBMain.POSITION=210-4,195-22
OBMain.SIZE=555,360
OBMain.ENABLED=TRUE
OBMain.BACKCOLOR=$c0c0c0
OBMain.TEXT="OBMain"

 ************ Button1 ************

CONSTRUCT Button1 AS Button
Button1.POSITION=47,41
Button1.SIZE=80,20
Button1.VISIBLE=TRUE
Button1.ENABLED=TRUE
Button1.BACKCOLOR=$c0c0c0
Button1.TEXT="Button1"
Button1.TEXTCOLOR=$0
Button1.FONT="Helvetica",8

*********** TextField1 ***********

CONSTRUCT TextField1 AS TextField
TextField1.POSITION=153,43
TextField1.SIZE=100,20
TextField1.VISIBLE=TRUE
TextField1.ENABLED=TRUE
TextField1.BACKCOLOR=$ffffff
TextField1.TEXT="TextField1"
TextField1.TEXTCOLOR=$0
TextField1.FONT="Helvetica",8

 ************ Initialize ************

A=1
B="Hello World"

************ Events ************

Button1.click
TextField1.Text=B
Exit Event



The compiler detected three errors. The first was the original syntax error that caused the problem. The second error was caused by trying to use the same variable that was not dimensioned properly and the third error was from using the variable that was not defined correctly in the first place. By changing line two to “DIM B AS STRING * 20” then the program will compile and run correctly.

Next Page: Chapter 7
Table of Contents

Home || Why Omnibasic || Features || FAQ || Examples
Reviews || Links || Privacy Statement || Top of Page

 

   Innomation Systems, Inc.

117 Morrison Ave. Morrison, MO 65061 (573) 294-6130

OmniBasic is a trademark of Innomation Systems, Inc., other trademarks are the property of their respective owners.
Innomation Systems, Inc. reserves the right to change prices and specifications without prior notice.
Copyright © 2000, 2001, 2002 Innomation Systems, Inc.