22.02.2014 Views

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DOS</strong> Programming Guide<br />

4.2 Building and Running the Sample <strong>DOS</strong>/<strong>4GW</strong><br />

Application<br />

To compile and link our example program which is stored in the file HELLO.C, enter the<br />

following command:<br />

C>wcl386 /l=dos4g hello.c<br />

The typical messages that appear on the screen are shown in the following illustration.<br />

C>wcl386 /l=dos4g hello.c<br />

WATCOM C/C++32 Compile and Link Utility<br />

Copyright by WATCOM International Corp. 1988, 2000. All rights reserved.<br />

WATCOM is a trademark of Sybase, Inc. and its subsidiaries.<br />

wcc386 hello.c<br />

WATCOM C32 Optimizing Compiler<br />

Copyright by WATCOM International Corp. 1984, 2000. All rights reserved.<br />

WATCOM is a trademark of Sybase, Inc. and its subsidiaries.<br />

hello.c: 6 lines, included 174, 0 warnings, 0 errors<br />

Code size: 24<br />

WATCOM Linker<br />

Copyright by WATCOM International Corp. 1985, 2000. All rights reserved.<br />

WATCOM is a trademark of Sybase, Inc. and its subsidiaries.<br />

loading object files<br />

searching libraries<br />

creating a <strong>DOS</strong>/4G executable<br />

Provided that no errors were encountered during the compile or link phases, the "hello"<br />

program may now be run.<br />

C>hello<br />

Hello world<br />

If you examine the current directory, you will find that two files have been created. These are<br />

HELLO.OBJ (the result of compiling HELLO.C) and HELLO.EXE (the result of linking<br />

HELLO.OBJ <strong>with</strong> the appropriate <strong>Watcom</strong> C/C++ libraries). It is HELLO.EXE that is run by<br />

<strong>DOS</strong> when you enter the "hello" command.<br />

16 Building and Running the Sample <strong>DOS</strong>/<strong>4GW</strong> Application

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!