BRender x86 Installation Guide:Configuring Your Compiler:2.1 Compiling DOS Programs
Next|Prev|Up
Watcom C V10/10.5
Borland C V4.5
MS VISUAL C V2.2/4.0

2.1 Compiling DOS Programs


The following sections guide you through compiling and running the sample BRender program minimal.c. For Watcom C and Borland C, it describes how to compile applications from within the IDE, as well as from the command line. For Visual C, only the command line option is available for DOS programs. The program minimal.c is included on the Tutorial Programs disk shipped with your BRender pack. Before proceeding, it is recommended that you create a directory, C:\BRENDER\TUTORIAL, and copy all files from the Tutorial Programs disk to it.

Watcom C V10/10.5

It is assumed that you have installed BRender and copied the contents of the Tutorial Programs disk to the directory C:\BRENDER\TUTORIAL.

From Within the IDE

1. Start the IDE and create a new project (pull down the File menu and select New Project) called tutorial(.wpj), in the directory C:\BRENDER\TUTORIAL.

2. Select DOS - 32-bit as the target environment. The image type is DOS4GW Executable[.exe].

3. Add the following source files (pull down the Sources menu and select New Source) to the project:

minimal.c

brdbwxrr.lib, brfwwxrr.lib, brmtwxrr.lib, brfmwxrr.lib

minimal.c, the file containing the C source code, can be found in the C:\BRENDER\TUTORIAL directory.

The .lib files can be found in C:\BRENDER\LIB. Note that the Fixed Point, Register Calling BRender libraries have been selected in this example (see Table 1). Select one of the other supported options if you would prefer.

You also need to add the appropriate DOS I/O library. For Watcom, Register Calling (DOS4GW) this is dosiowrr.lib, hst4gwrr.lib, brpmwrr.lib, brstwrr.lib.

4. Select 4-byte alignment:

Options

C Compiler Switches

File Option Switches

Source Switches

(pull down the Options menu and select C Compiler Switches, pull down the File Option Switches sub-menu and select Source Switches, select 4 byte alignment).

5. To tell Watcom where to find BRender Header Files, add c:\brender\inc and c:\brender\dosio to the Include directories: option under File Option Switches.

Options

C Compiler Switches

File Option Switches

Include directories:

6. Make sure the target processor matches your machine and the calling convention (register or stack) is consistent with the selected BRender libraries.

Options

C Compiler Switches

File Option Switches

Memory Model and Processor Switches

Target Processor

7. Compile and Run the sample program. It displays a revolving grey cube.

From the Command Line

Make C:\BRENDER\TUTORIAL the current directory, then enter the following command from the DOS prompt:

wmake -f makefile.wat

The makefile `makefile.wat', which can be found in C:\BRENDER\TUTORIAL, specifies relevant libraries and header files and selects appropriate compiler options.



Borland C V4.5

Note that a 32-bit DOS extender must be installed on your system for BRender to work with Borland C. BRender supports Borland PowerPack and PharLap TNT.

It is assumed that you have installed BRender and copied the contents of the Tutorial Programs disk to the directory C:\BRENDER\TUTORIAL. For the purposes of this tutorial, it is also assumed that you have installed Borland PowerPack 32-bit DOS extender.

From Within the IDE

1. Create a new project called tutorial(.ide), in the directory C:\BRENDER\TUTORIAL.

Project

New Project

Project Path and Name:

2. In the same window, select DOS 32-bit as the target. Accept the default target type (Application) and other default settings.

Platform:

3. Delete default node tutorial [.cpp] if present (highlight node, then press [Delete]). Add the following source files (press [Insert] then select files):

minimal.c

brdbbxr.lib, brfwbxr.lib, brmtbxr.lib, brfmbxr.lib

minimal.c, the file containing the C source code, can be found in the C:\BRENDER\TUTORIAL directory.

The .lib files can be found in C:\BRENDER\LIB. Note that the Fixed Point BRender libraries have been selected (see Table 1). Fixed point arithmetic is faster, though less accurate, than floating point arithmetic.

You also need to add the appropriate DOS I/O library. For Borland C using POWERPACK, this is dosiobr.lib, hstppbr.lib, brpmbr.lib, brstbr.lib.

4. Select 4-byte alignment:

Options

Project

32-bit Compiler

Processor

Data alignment

5. To tell Borland where to find BRender Header Files, add c:\brender\inc and c:\brender\dosio to the Include Source Directories option under Directories.

Options

Project

Directories

Source Directories

Include:

6. Compile and Run the sample program. It displays a revolving grey cube.

:

From the Command Line

Make C:\BRENDER\TUTORIAL the current directory, then enter the following command from the DOS prompt:

make -f makefile.bcc

The makefile `makefile.bcc', which can be found in C:\BRENDER\TUTORIAL, specifies relevant libraries and header files and selects appropriate compiler options.



MS VISUAL C V2.2/4.0

Note that PharLap TNT 32-bit DOS extender must be installed on your system for BRender to work with Visual C V2.0.

It is assumed that you have installed BRender and copied the contents of the Tutorial Programs disk to the directory C:\BRENDER\TUTORIAL.

From the Command Line

Make C:\BRENDER\TUTORIAL the current directory, then enter the following command from the DOS prompt:

nmake -f makefile.msc

The makefile `makefile.msc', which can be found in C:\BRENDER\TUTORIAL, specifies relevant libraries and header files and selects appropriate compiler options.




Generated with
CERN WebMaker