IDE paths
From Open Watcom
DRAFT, IN EDIT
The OpenWatcom IDE has a specific model of where disk files can be located and this cannot be changed. This works well for small and moderate sized projects. Large projects are beyond the IDE and other tools such as wmake have to be used. There is no hard limit saying Large.
Contents |
Layout
There are three disk areas
- location of the IDE control files
- locations of source files
- locations of target projects (such as libraries being built, executables being built)
Basic usage
This is the simple and very obvious scheme of putting all files in one directory and it works for very simple projects with just a few sources. It can be used with any sized project provided there are no file name conflicts but is poor practice.
Full usage
You can use any combination of the following to organise your files. Reading this will make it seem more complex than it really is, yet in reality it is very simple.
- The object files, any libraries or executables produced are located in the same place as defined for the target file.
- The IDE is told where the source files are located and then if necessary tell the compiler and perhaps the linker the path to the location of these files via include.
You can use absolute file paths but relative paths are the normal way to do it. As a reminder ./ means the current directory and for Microsoft both ./ and .\ mean the same. ../ means up one directory. ../../ up two
An example, here is a fictitious small project which is deliberately using different directories so that it illustrates all the concepts.
The absolute file path to our projects on Windows is E:\myfiles\myprojects\ but we can forget that, it does not matter if we use relative paths.
Our source files are in myproject/sources1, the header files in sources1/include
The IDE project files are in myproject/build4 and the created executable and intermediate files are in build4/debug or build4/release
Invoke the IDE without a project. This will show a blank window.
Invoke File/New project and navigate to E:\myfiles\myprojects\build4 If build4 does not exist, under Windows the file dialog includes a create new directory button, use it.
Make sure you are in build4 and now type in the project name, build4.wpj and click Open (Ok button)
You now have a project file and you have a new dialog, create a new target within the project.
If you just click OK the executable and intermediates will go into the build4 directory but in this example we want then put somewhere else.
Click Browse. We want to put the target into the debug directory, navigate there. Create a new directory if you need to.
Make sure you are in the debug directory and then type in the name of the target build4.exe (or anything else, could be a lib or dll and so on). Notice the target file is shown as having a relative path.
Select the correct type and click OK.
You now have a project and target. The IDE target window will be open and empty.
That has to be populated with source and optionally header files. I leave that as an execise for the reader. (Note the default for a new project is build debug version. Release mode is a separate configuration)
The final step is tell the compiler (and perhaps the linker also) the paths to the source, header or resource files.
Under compiler options, first page, there is includes and that is where the relative file paths are put.
Under Windows NT it will probably already have this in the field "$(%watcom)/h;$(%watcom)/h/nt"
The first thing wmake does when it builds your executable is cd (change directory) to the target path.
- You have to specify includes relative to that path**
In the example given edit the includes line to this
"$(%watcom)/h;$(%watcom)/h/nt;../../sources;../../sources/include"
Up two directories and down into sources, and also down into sources/include
All being well the project will now compile. More complex projects usually need paths and libraries added to the linker. Any Macro definitions are put on the third page of the compiler configure. Reminder: often OW needs more than default stack space, leading to very strange problems. Use Linker options, first page, stack and for example for a very large space type in 256k
It went wrong! How do you discover how to debug the configuration? At the bottom of the IDE window is the IDE log window.
The first few lines on starting a compile will tell you what you need to know.
Changing from compile by the IDE to compile using wmake
A tool is provided which creates wmake makefiles from a IDE project files.
ide2make
Example. Go to a command line in the directory where the project .wpj exists. If the file is named synth.wpj
ide2make -r -p synth
That will produce Release (-r or -d for Debug) makefiles, usually two files where the first one calls the second.
Then, wmake -f synth.mak
If necessary you can of course use command line overrides, such as macro definitions, although these would normally be taken from the IDE configuration. Eg. wmake -dWIN32 -f synth.mak
Your project is built. This assume of course that the IDE project is valid, there is no magic.

