Open Watcom at VTC


Open Watcom is an open source C and C++ compiler (also Fortran 77) with a rich collecton of tools. It is a cross-platform product running on Windows, OS/2, and DOS (32 bit extended) hosts. Each host can generate programs for all supported systems including 16 bit variations. The current version of Open Watcom also includes experimental support for generating Linux executables.

Note that Open Watcom is a relatively old compiler that is in the process of being modernized and updated. Be aware of this when you work with the system.

For more information about the Open Watcom project see the Open Watcom version 2.0 site.


Installation of Open Watcom is straightforward. See my documentation describing the steps.

Using the IDE

This section describes how to use the Open Watcom integrated development environment to define a project.

  1. I recommend creating a separate folder for each project that you make. It is easiest to create this folder before trying to create the project. You can name the folder whatever you like; it does not need to have the same name as your project (although that would be the common case).

  2. From a console configured with the Open Watcom environment, type ide.


  3. In the IDE, from the "File" menu select "New Project...". You can use "Open Project..." to open a project that already exists. Browse to the folder where you want to create the project and specify a name for the project by changing noname.wpj to something more suitable. Be sure to keep the .wpj extenstion on the project definition file.

  4. Each project can have multiple "targets." A target is, for example, an executable file or a library. Large projects are typically composed of several related programs. You would define a different target for each program.

    After specifying the project you will be shown a "New Target" dialog box where you can provide the name for the target and the precise type of target you want to use. On Windows the default will be a Win32 character mode (command line) executable. This is often what you want.


  5. Once you have selected your target the IDE will show a window for that target inside the main window. Right click inside the target window and select "New Source..." from the context menu that appears. Select the source file (or files) that you want to be part of your project. You can specify files that don't yet exist. After closing the file selection dialog you will find the files you mentioned listed in the target window.


  6. Double click on the name of the file to launch the Open Watcom editor on that file. The editor is a separate program but it communicates with the IDE as you will see. Enter a small sample program.


  7. Switch back to the IDE and use F4 to make the current (and only target). You will be prompted to save your changes in the editor. The IDE opens a "log" window that shows the progress of the compilation. Error messages appear here. If you double click on an error message you will be taken to the appropriate line of code in the editor.


  8. To run the program you can click on the running man button on the IDE's tool bar. For a command line program this opens a new console and executes the program in that console. If you program terminates without pausing, the new console will close immediately and you won't be able to easily see what the program does. In fact if the program runs quickly it may not be obvious that it runs at all! As a result of this you may want to execute such programs in an entirely separate console window.

    If your program requires command line arguments you can specify them to the IDE using the "Options|Run Switches..." menu item.

  9. By default your program will be compiled with debugging support. To run the debugger click on the "locally debug current target" button on the tool bar (the picture of the bug being zapped by a lightening bolt where the lightening is touching the bug). The debugger is also a separate program.


Using Command Line Tools

The IDE makes it easy to select compile options and gives you a nice graphical overview of your project. However, for small programs it is often easier to just use the command line tools directly.

The basic Open Watcom commands are:

You can generate 16 bit code using wcl instead of wcl386. On Linux you can use owcc as a "cc" clone. It takes the same command line options as traditional Unix (POSIX) C/C++ compilers. If you invoke a tool without any arguments the tool typically prints a list of common options that it supports. You can also launch the graphical tools from a command prompt. You just need to know the names. The integrated development environment is ide. The windowed debugger is wdw.

Don't hesitate to let me know if you have any problems accessing these files or if you have any suggestions or bug reports for Open Watcom.

© Copyright 2010 by Peter C. Chapin.
Last Revised: October 2, 2019