How to use the VBCC Compiler

VBCC

The VBCC compiler was released by Dr Volker Barthelmann in 2001 (0.8). The lastest version of VBCC is 0.9h.

Contents of VBCC Package:

VBCC consists of two parts: A binary package and a target package. There are binary/targets for AmigaOS (68K or PPC), Morphos, Powerup, Warpup and Atari MiNT.

Installation

Download the binary and target archives from the VBCC website and extract the files to a folder on the hard disk.

Run the Install script for the binary files first and then Install the target files next.

You will need the include files from the either the Amiga Developer CD 1.2, NDK 3.2, NDK3.9 or AmigaOS 4 SDK for your system, the Amiga one is on Aminet. For Morphos, try the Morphos Downloads. Put the target includes in the vbcc\targets\m68k-amigaos\include folder, then put the NDK includes in either vbcc\includes or other folder of your choice and add folder to the vincludeos3: or whatever assignment.

Directories and folders

An VBCC installation contains a number of directories and assigns needed for it to run.

vbcc - main directory
bin - program files
config - contains aos68k and vc.config files
doc - contains documents in mainly pdf and doc formats
target - platform specific files including libs and include files

Assignments

vbcc: - main VBCC folder assign.
C: - Add vbcc:bin to C: assign list
vincludeos3: - Assign header includes location e.g. AmigaOS3
vlibos3: - Assign library folder location e.g. AmigaOS3

VBCC Main Programs

vc - Main compiler and build program
ar - archive tool
fd2pragma - Converts FD files to pragma files
showerr
tovbr
vasmm68k_mot
vasmm68k_std - MC 680x0 assembler
vasmppc_std - MC PowerPC assembler
vbccm68k - 68K compiler
vbccm68ks
vbccppc - PPC C compiler
vbrowse - Message browser
vlink - Linker
vobjdump
vprof - Program profiler (determine timings)
vscppc
vsend

If you need a debugger you can use CPR from SAS/C or BDebug from the BarFly tools. (new)

How to create an VBCC Project

1. Open a Shell

2. Create a new folder for your directory e.g. makedir Work:MyProject and cd to it.

3. Use Ed or your favourite editor to create your source code e.g. ed program.c

4 To compile a single program, enter vc program.c -o program

To compile with one or more libraries use -l option e.g vc program.c -lamiga -lauto -o program

If you do not specify the -o option then the resulting program will be called a.out. If you forget the -o option, you can rename the a.out file to a more meaningful name.

You can specify multiple options with vc (see the vbcc documentation on what the options are). If there are too many options

then use the -cmd option and use a file with all the options specified in it.

5. To test your program type the program name e.g. program.

Conversion notes from SAS/C or Storm C sources

1. Use the correct and latest headers, e.g. NDK 3.2 or later where possible and use the proto headers files.

2. Always make sure function main() returns an integer. Don't use void.

3. Casting of variables or values is important. Use of NULL can cause casting errors, use 0 (zero) instead.

4. Use ANSI C or AmigaOS function calls where possible, avoid old compiler specific calls.

5. VBCC does not support C++ so do not use // style comments or C++ classes or functions.

6. For Printf or Sprintf, use correct variable types in string: use %u for unsigned values, %d for signed, %ld for long signed values, %s for strings.

7. The Reaction macros from NDK 3.5/3.9 do not work in VBCC, they don't expand correctly during compile, so use the full NewObject() function will
proper TAG_END) at the end of object's tags.

8. Most C code compiled with Storm C should work on VBCC.

Storm C Compiler