Using wxWidgets with Gnu-Win32 (older versions)
This is how to get wxWidgets and Gnu-Win32 cooperating, so you can compile a free
multiplatform framework with a free Windows 95/NT compiler.
See also the Gnu-Win32 Web page.
Colin Peters has his own Gnu-Win32 web site
which has useful extra information, including a package Ming32 (Minimalist Gnu-Win32) which does
without the Cygnus support files (and doesn't fall under the GPL). Other things of interest on this site include
cross-compilation files for developing Win32 program on UNIX, and a pointer to the resource compiler tools rcl.exe and cvtres.exe.
wxWidgets 1.67 and Gnu-Win32 b18
wxWidgets 1.67 supports Gnu-Win32 with less patching of the compiler than with previous
versions of both of these packages. wxWidgets contains
extra include files in include/msw/gnuwin32.
Thanks are due to Keith Garry Boyce (garp@opustel.com) and Cygnus for making it
all possible.
Here are the steps required:
NEW!! As of September 11th 1997, there is a changed procedure for getting wxWidgets
compiled with Gnu-Win32. The previous method, using cvtres.exe, didn't work on NT, so now
we will use the same rcl.exe plus a program called rsrc.exe to bind the .res file to the executable.
These files are from the DJGPP C compiler, and the method works on both Windows 95 and Windows NT.
They come originally from the file rsxdj131.zip in
ftp://sunsite.doc.ic.ac.uk/packages/simtelnet/gnu/djgpp/v2tk/. Thanks to Joern Eggers (eggers@landsh.de)
who supplied the information, and also warns that rcl.exe only works well when full paths are supplied:
I haven't been able to verify that the makefiles work on NT but they work on Windows 95.
The instructions that follow have been modified accordingly.
- Retrieve and install Gnu-Win32 as per the Cygnus instructions.
- Get the file
ftp://ftp.aiai.ed.ac.uk/pub/packages/wxwin/ports/gnuwin32/rcl_rsrc.zip (139 KB). This contains two main files: rcl.exe
and rsrc.exe, for compiling resources and binding resources to the Windows executable.
Copy these two files to your gnuwin32/b18/H-i386-cygwin32/bin directory, along with the file rsxnt.dll.
- Modify the file wx/install/cygnus.bat to set up appropriate
variables, if necessary mounting drives. Run it before compiling. The variables
are: GCC_EXEC_PREFIX, RCINCLUDE and CPLUS_INCLUDE_PATH. The latter must have paths for
resources too since it's used as the resource file preprocessor. You don't need
to edit makeg95.env as well as this batch file.
- Make sure you have a /tmp directory on the same drive as wxWidgets, or BYACC will produce
nonsense and y_tab.c won't compile properly, producing spurious errors.
- If you already use a DOS FLEX, adjust your path so the Gnu-Win32
one is picked up instead.
- Use the makefile.g95 files for compiling wxWidgets and samples. E.g. 'cd c:\wx\src\msw' followed by
'make -f makefile.g95'.
- Use the 'strip' command to reduce executable size.
I haven't yet tried the debugger but advice on that should follow (contributed notes welcome!)
Gotchas are, as far as I know, the same as the ones mentioned below.
wxWidgets 1.66E/F and Gnu-Win32 b17
These are the old instructions for previous versions of both packages.
As of Beta 17 of Cygnus Gnu-Win32 and wxWidgets 1.66E, it is possible to
use Gnu-Win32 to compile wxWidgets, thanks to Keith Garry Boyce
(garp@opustel.com) and others.
- Retrieve and install Gnu-Win32 as per the Cygnus instructions.
- Get the file 166e_g17.zip from the ports/gnuwin32 directory of the AIAI
ftp site, and unzip with a long-filename-aware unzipper from
the Gnu-Win32 compiler root directory. This replaces and adds files
for WIN32 programming.
- Change Gnu-Win32's String.h to another name to avoid conflicts.
- Modify the file wx/install/cygnus.bat to set up appropriate
variables, if necessary mounting drives. Run it.
- Make sure you have a /tmp directory on the same drive, or BYACC will produce
nonsense and y_tab.c won't compile.
- If you already use a DOS FLEX, adjust your path so the Gnu-Win32
one is picked up instead.
- Use the makefile.g95 files for compiling wxWidgets and samples.
- Use the 'strip' command to reduce executable size.
Gotchas:
- libwx.a is 27 MB.
- Print preview doesn't seem to work.
- The resource example doesn't load resources, although PrologIO
seems to be working in Dialog Editor.
- wxPoem doesn't display properly.
- install.exe doesn't have built-in decompression because lzexpand.lib
isn't available with Gnu-Win32. However, you can use it with external
decompression utilities.