by Cameron Donaldson
Questions regarding this document should be sent to howtos@mr_cam.org (please remove the _ from mr_cam when sending email).
This is a mirrored copy of a document that appears to no longer exist at its original URL. It was retrieved from an archived version at the Internet Archive's Wayback Machine, and is duplicated here for convenience.
This document outlines how to install and configure Eclipse, MinGW, and wxWidgets to create portable C++ GUI applications in Windows 2000 and Windows XP.
This document simply outlines the steps I took to get Eclipse to a point where I could compile debug and release versions of the included wxWidgets samples.
I found it very difficult to get to the point where compiled samples could execute. This was simply due to a lack of useful documentation on this topic. This is why I have created this document.
This document is a work in progress. As time goes and I discover more information and/or shortcuts, I will update this document appropriately.
In order to create portable C++ GUI applications on Windows 2000, you will need to download various tools. Below is a list of what you will need. While you can most likely use a different version of one or more of the tools below, no guarantee is made that this document will be applicable. If you use a significantly different version of one of these tools, you may need to adapt the instructions in this document appropriately.
You will need
The first thing you will need to download is Eclipse. Eclipse is a very powerful workbench that provides incredible flexibility through the use of plug-ins. Eclipse comes as a powerful Java IDE out-of-the-box. You can download the CDT plug-in to develop with C and C++. While the CDT plug-in was designed with Linux in mind, it will work on Windows 2000 (and this document tells you how to do this)
Visit http://www.eclipse.org for
information on how to download and install Eclipse.
Visit http://www.eclipse.org/cdt/ for information on how to download the CDT Plug-in.
Once you have Eclipse and the CDT installed, continue onto the next section.
This step is optional.
Cygwin provides a Unix/Linux development environment for Windows. It comes with the tools you'll often find in standard Unix and Linux implementations. You can combine these tools with Windows command line tools to increase the flexibility of your Windows OS, among other things. While Cygwin can be very useful, it isn't required. You can download Cygwin if you'd like. I have Cygwin installed, but I did not install it exclusively for the purpose of setting up my Windows environment to develop C++ GUI applications.
The only reason I mention it here is because some people decide to use Cygwin while configuring their system for C++ GUI development (as you may have learned if you've read other similar sites.). I decided not to use Cygwin, and provide alternative methods below.
Visit http://www.redhat.com/software/cygwin/ for information on how to download and install Cygwin.
Whether you decided to download Cygwin or not, continue onto the next section.
From here on in, the root directory in which you installed Cygwin will be referenced as <CYGWIN>. For example, if you installed Cygwin into C:\cygwin, then you will replace all future references to <CYGWIN> in this document with C:\cygwin
MinGW is a collection of Windows header files and libraries combined with various development tools that allow you to produce native Windows programs that do not rely on any 3rd party C runtime DLLs. One advantage to using MinGW over Cygwin is that programs you create do not rely on any DLLs. With Cygwin, any program you create is dependent on the cygwin1.dll file. The non-dependency of 3rd party DLLs makes it easy for you to distribute your programs, among other things.
MSYS is a minimal set of tools that allow you to manage Makefiles using make. MSYS, in this case, is combined with MinGW to provide more functionality.
Visit http://www.mingw.org and download the following items:
Follow these steps:
Once you have completed installing MinGW and MSYS, proceed with the next section.
wxWidgets (formerly wxWindows,) is a C++ GUI framework that allows you to write cross-platform C++ GUI applications. Essentially you should be able to write an application using wxWidgets and have it run on any platform for which there exists wxWidget libraries.
Visit http://www.wxwidgets.com and download wxWidgets 2.4.2 for Windows.
Follow these steps:
Now it's time to compile wxWidgets. There are many options (as presented in <WXWIN>\docs\msw\install.txt.) I outline the steps I took below:
First, create the following directories:
These will each hold libraries which will soon be created. Eclipse will use libraries stored in the debug folder to create debug versions of your program. Similarly, Eclipse will use libraries stored in the release folder to create release versions of your program.
Go to your desktop and double click the MSYS shortcut. If you removed it, or it is not on your desktop, run <MSYS>\1.0\msys.bat instead.
Enter the following sequence of commands to create debug libraries. Note: the dollar sign is a prompt; you omit the dollar sign when entering the commands.
$ cd <WXWIN>/src/msw
$ make -f makefile.g95 clean
$ make -f makefile.g95
Move all files ending in .a in <WXWIN>\lib\ to <WXWIN>\lib\debug. Make sure there are no .a files in <WXWIN>\lib\ after the move.
Enter the following sequence of commands to create release libraries:
$ cd <WXWIN>/src/msw
$ make -f makefile.g95 clean
$ make -f makefile.g95 FINAL=1
Move all files ending in .a in <WXWIN>\lib\ to <WXWIN>\lib\release. Make sure there are no .a files in <WXWIN>\lib\ after the move.
Copy <WXWIN>\include\wx\msw\setup0.h to <WXWIN>\include\wx\
Rename <WXWIN>\include\wx\setup0.h to setup.h
This is all I did for this step. Once you become more familiar with wxWidgets and Eclipse, you can look into the various compilation options the wxWidget makefile lets you use.
Once you have everything compiled and copied to their proper folders, proceed to the next step.
For this step I suggest making a very simple base project which you can just copy when creating future wxWidget projects. This will save you from performing these steps each time you want to create a new C++ project that uses wxWidgets.
So first we will create a pre-configured base project:
Now we must configure this base project so that it can properly include and compile wxWidget resources. These are the options I ended up using to get my wxWidget programs to compile. As time goes on, and I discover improvements which can be made to this configuration, I will post updates on this page.
To configure our base project, make sure you are in the C/C++ Perspective in Eclipse, and follow these steps:
That should be it.
Now it's time to test the configuration by trying to compile one of the sample C++ files that comes with wxWidgets:
The type of executable that is generated depends on the currently selected configuration. To create a release or debug executable, right click the wxWidgetsBasePrj item and select Properties. Select C/C++ Build and choose a configuration. Click OK.
Select Project from the file menu, and select Clean.
If everything was configured properly, either a debug or release executable will be created (depending on what configuration you just selected.)
You can either setup a run configuration for the project to run this file (see http://www.eclipse.org for instructions,) or you can simply locate the file on your file system. If you did not change the default workspace location, then the file you will be looking for will be located in either the debug or release folder in C:\eclipse\workspace\wxWidgetsBasePrj
I have not tried configuring Eclipse, MinGW, and wxWidgets to work on any other operating system besides Windows 2000 and Windows XP. For other Windows operating systems, I'd imagine the Eclipse configuration portion will remain the same. The only difference may lie in the compiling of wxWidgets. Refer to documentation supplied with wxWidgets for details on compiling with Windows 9x.
I will post any information I come across that may provide useful when performing the above outlined steps on a different OS.
Last Updated: 12/27/2004 02:31:34