Skip to main content

Site moved!

  This blog has been retired and its content was moved to a new Amiga-friendly site. Please visit:  https://developer.amigaos3.net/

NDK Setup for the VBCC Compiler

vbcc is a highly optimizing portable and retargetable ISO C compiler by Volker Barthelmann. It supports ISO C89 and a subset of C99. It's also still being developed and offers a variety of target distributions and cross-compiling options. Best of all: It's free.

The AmigaOS distribution of vbcc is maintained by Frank Wille and can be downloaded here. Frank added support for the NDK3.2 in vbcc 0.9h, so you'll have to get this version or a later one.

Installation of the compiler is simple: You'll have to download the vbbc main archive suitable for your system plus at least one Amiga-related target archive, first. We'll assume you want to compile on Amiga natively, so we choose:
(download by right-clicking the link & select "save as")

Open a shell. We assume you have lha installed. If not, get it here (download by right-clicking the link & select "save as"). Extract both archives to a temporary location, e.g. RAM:.
lha x vbcc_bin_amigaos68k.lha ram:
lha x vbcc_target_m68k-amigaos.lha ram:

Install the NDK by extracting the archive to the desired location, e.g.:
lha x NDK3.2.lha Data:AmigaOS/NDK3.2

Now run the Installer script for both vbcc's main archive and target archive via Workbench. During installation of the target, you'll be asked for the location of the NDK's header files. Enter the directory you installed the NDK3.2 in and select the subdirectory "include_h":

Depending on the location you have chosen during install, an assign named vbcc: will be created. In our example, we installed vbcc to "Work:Develop/vbcc" and the NDK3.2 to "Data:AmigaOS/NDK3.2", so your paths may be different. Edit your s:user-startup file using TextEdit or similar, and make sure it'll contain the following:
;BEGIN vbcc
assign >NIL: vbcc: Work:Develop/vbcc
assign >NIL: C: vbcc:bin ADD
setenv VBCC vbcc:
assign >NIL: vincludeos3: vbcc:targets/m68k-amigaos/include
assign >NIL: vincludeos3: Data:AmigaOS/NDK3.2/include_h ADD
assign >NIL: vlibos3: vbcc:targets/m68k-amigaos/lib
assign >NIL: vlibos3: data:AmigaOS/NDK3.2/lib/ add 
;END vbcc
The line "assign >NIL: vlibos3: data:AmigaOS/NDK3.2/lib/ add" won't be created by vbcc installer, so you'll have to add it yourself if you want to compile programs making use of debug.lib.

Reboot.

And that should be it. :-)
Let's enter a small C program to verify the procedure. You can use any text editor of your choice, but we'll use TextEdit now to create the file for demonstration purposes:
Textedit HelloWorld.c

Enter the following lines:
#include <dos/dos.h>
#include <proto/dos.h>

int main()
{
	Printf("Hello, World!\n");
	return(RETURN_OK);
}


Save, close Textedit and compile & link the program with:
vc +aos68k -o=HelloWorld HelloWorld.c
And that's it - you should have a binary named "HelloWorld", now. The program uses the Printf() function of dos.library instead of the compiler-supplied printf(). So you'll be fine, if it compiles successfully. Thanks go to Frank Wille for his comments, corrections and additions to the AmigaOS3.2 NDK. We also thank Volker Barthelmann and Frank for creating and maintaining this wonderful compiler.

Comments

  1. Lower case "p" on printf

    ReplyDelete
    Replies
    1. No, this is dos.library/Printf(). As described in the post.

      Delete
  2. Thanks for this very usefull and quick tutorial!

    ReplyDelete
  3. Thanks! Please keep these tutorials coming, I will be following.

    ReplyDelete
  4. Thanks for this, very interesting!

    ReplyDelete

Post a Comment

Popular posts from this blog

Recommended reading for the Amiga Developer

Developing software takes a lot of knowledge. The thirst for information is endless. In this post we will make our recommendations on what to read, and they can all be found online in pdf format. The AmigaOS 3.2 Native Developer Kit The NDK contains autodocs and include files, but also examples and some documentation. Get it from the official Hyperion website  or from  Aminet . Amiga ROM Kernel Reference Manual: Libraries This is the first part of the Technical Reference Series by Commodore covering Release 2 of AmigaOS. and it comes with our highest recommendations. This is without a doubt the most important book to have. It deals with every library of the 2.04 except dos.library, which is covered in The AmigaDOS Manual listed below. It is not a holistic tutorial, but as the title suggests a reference manual. It is however written in an explanatory manner with for example a whole chapter about Exec Lists and contains many examples written in C. It can be found  here...

About this Blog

The AmigaOS development blog contains articles written by the core AmigaOS 3.2 for 68k developers and friends.  Our goal is to encourage and support your first steps into the fascinating realm of developing for the classic Amiga operating system.  No matter if you just want to write a small tool, a little game or a a full-blown application - starting development can provide frustrating experiences, especially on a retro operating system.  We'd like to remedy this by providing a series of articles, covering installation of development tools, programming examples, debugging war stories and other helpful tips.