Categories: Linux Tutorials

How To Setup Open Watcom On WINE For Windows Programmers

​Open Watcom is a C/C++ compiler suite (including FORTRAN) for Windows, handy for those Linux users who wish/need to program in Windows environment but don’t have one. This is the only successful programming tool that runs under WINE! Still, that doesn’t mean it works fine without errors. That’s also the fun part because you get the opportunity to use commands more often for compiling, linking and then running the program.

Installing Open Watcom

​You can download the software from here. And for configuration, it’s better to select the target and host as Win32 (NT/Win95/Win32s), well that depends on which platform you are intending to develop for. But if you have no idea then you are best left with Win32 as this will allow your compiled program to run on Win XP and later versions (yeah Win 10 counts too).

Starting ‘hello’ project

​Let’s launch Open Watcom using application launcher and run a sample hello world program. Press alt+f2 and type in this command:
wine ide
​CTRL + n to start a new project. And [assuming target for Win32] for now, we’ll be working on Character mode executable program then press the ins key on your keyboard to insert the source file. Specify its name as hello.c in the dialog box, Click Add and close it.

​Double-click it and you’ll get a new editor window.

​REMEMBER not to close this editor window once you’ve opened it until you are sure you won’t be working on the project. Otherwise, you’ll be greeted with an error the next time you try to re-open the editor again.

Compile ‘hello’

​Code in hello program on the editor and then (5 seconds later) it’s time to compile your hello world program. There are two ways to compile: GUI or CLI.GUI


For Command Line Interface method you have to launch ‘system’ under file menu from the editor window then compile link as described below –

wcc386 -bt=nt hello.c
wcl386 -bt=nt hello.obj

​By the way, if you’ve configured Watcom differently on your system, for instance enabling all target and host platforms you might be trying this way –wcc hello.c

Well, that looks similar to GCC on Linux but the issue with this is that you are compiling for the 16-bit processor. You’d have to look at the history of microprocessors for the better understanding of processor numbering, why 32-bit are often referred to as 386, 486, 586.

So the above wcc386 actually compiles your hello world program for 32-bit Windows OS and the extra argument -bt=nt actually means “Binary target” and for ‘nt’ you got it this way NT. All lines from Win XP till 10 are families of Windows NT.

Running ‘hello’

​If you haven’t closed the previous instance of CMD key in this –
hello or .\hello

​Unfortunately, the GUI way of running this text-based program is an issue (no visual output) and the solution will be presented later.


​Keep in mind that this solution is also not really a solution when you have a program that has to pass arguments in the main function and in that case you’ve to stick to the previous method of compiling, linking and running using the console program. Now the best part about this is GUI saves a lot of time and eases you the programmer from having to type in compiler commands and arguments all the time. Here’s how you’d do to launch Watcom

Fire up your terminal and key in this:

wine ide
​REMEMBER never close the terminal even when nothing more can be done on it (i.e. unusable). Open your hello world program and click those in sequence.

​Well, when Run was clicked the output was piped to the terminal and you’d have noticed this.

​So for all the programs that don’t need argument passing in main() or those that implement WinAPI in which an actual window is created.

Nasty behavior

​Ah-ha! You might have this syndrome of closing windows just for the sake of switching it. Unbreakable habit. Then you have the option to change the text editor of your choice; by clicking on File of the IDE window and selecting Set Text Editor. This will ease without error messages as you close and reopen the text editor

​And don’t forget if you intend to use notepad++ or any executable file as your editor then –
Enter editor parameters: %f
Editor type: Executable


​All well knitted now and you are on the right way to program your way outta here. And for the guys here who insist codeblocks is better and runs on win, additional tool (PlayOnLinux) is required to successfully set it up but note that Watcom consumes fewer resources and comes with rich API to develop Windows applications. Happy programming!

Mohd Sohail is a web developer and a Linux sysAdmin. He also loves to write how-to articles, applications reviews and loves to use new Linux distributions.

Recent Posts

How To Host Counter-Strike: Global Offensive Server on Ubuntu

Counter-Strike: Global Offensive popularly known as CS: GO is one of the most popular games…

2 days ago

Blogging with WordPress | WordPress 101

Welcome back to WordPress 101 series. In this series, we're learning the basics of WordPress.…

4 days ago

Top 8 Desktop Environments For Linux [2021]

Linux distributions come in various flavors. No matter if users are joining in from Windows,…

2 months ago

Ubuntu 21.04 “Hirsute Hippo” Released

Today Canonical has released its latest version of the operating system, Ubuntu 21.04. Ubuntu 21.04…

2 months ago

Telegram Launched Telegram WebZ & Telegram WebK

Telegram is a popular instant messaging app known for protecting users' privacy while providing the…

2 months ago

Install Discord On Linux

When you divide gaming into two eras, then you get gaming before the advent of…

2 months ago