Using Code::Blocks with Open Watcom
This article is based on Open Watcom Configuring Code::Blocks.
This article applies to C::B version 8.02, OW version 1.7a, and Win32. A standard OW and C::B install is compatible and C::B can usually find OW without problems. C::B compilation and linkage will operate out of the box, debug will not.
C::B is configured to use GNU GDB as the debugger but this is incompatible with Windows PE format executable as created by OW. Using the Windows OW debugger works fine but C::B needs configuring to do this:
- C::B menu/Settings/Compiler and debugger
- Select OpenWatcom (W32) Compiler
- Scroll down the list of options to find "watcom debug format [-hw]" and check that item only for debug format (reason is that C::B seems to have hard coded "debug watcom all" elsewhere and is a conflict this resolves)
- Click "Linker settings" tab
- In the "Other linker options" edit area enter:
Note: the very small default stack size used by OW can cause problems. One of several different ways of telling the linkers to increase the stack size is define it in the same edit box, for example like this on two lines (not on the same line):
op symf stk=64k
- Click Ok.
The compiler and linker will now create files the OW debugger understands. The next step is telling C::B how to call the OW debugger. It is very simple, we ignore the debugger built into C::B and call an external tool:
- C::B menu/Tools/Configure tools... click "Add"
- Name it perhaps OW debugger
- Navigate to and set the OW debugger, eg. C:\watcom\binnt\wdw.exe
- Parameters set to $(TARGET_OUTPUT_FILE)
- Check second item "Launch tool hidden with standard output redirected"
All done but before you Ok that here is something important: C::B does have a facility to set the command line parameters of the program but that does not work here. The workaround is edit that parameter line above, easy to do, for example, like this:
$(TARGET_OUTPUT_FILE) -myfile -d
That is it.
OW has other tools which could be called, new items on the tools menu. Left as an exercise but feel free to edit new instructions into this WiKi.