Installing wx 2.4 with VisualStudio 6

From WxWiki
Jump to navigation Jump to search
This article applies to the following versions
Platform wxWidgets Visual C++
Windows XP 2.4.2 6
Status: Out of Date


Installing wxWin to work with VC++ 6.0

This is easily the easiest platform on which to get started with wxWidgets.

Note that VC++ 7 (.net) is very much the same, and you can open the .dsw files (below) in the same way. However preferences will be saved to .vcproj files instead.

Install notes

Download wxMSW-2.4.2-setup.zip. Unpack to a temporary folder and run setup.exe.

This will prompt for a folder and a group. It's best (but unnecessary) to change the folder to something short, like c:\wx, as you will need to enter this in various compiler options. For these notes, it will be presumed that we install to c:\wx.

Everything else is routine.

Build the library

This can be built as a DLL or a .LIB. These notes choose the latter.

Change to c:\wx\src. There is a wxWidgets.dsw file there (a VC++6 project). Double-click on it to open it. It should open without problems.

Go to Build > Set Active Configuration. Select "wxWidgets ― Win32 Debug" (at the end, after all the Unicode and DLL options). Then Build|Build wxWidgets.lib. This will compile the whole library in debug mode, but will take a while!

There will be 7 warnings:

C:\wx\src\tiff\tif_getimage.c(1545) : warning C4550: expression evaluates to a function which is missing an argument list
C:\wx\src\tiff\tif_getimage.c(1546) : warning C4550: expression evaluates to a function which is missing an argument list
C:\wx\src\tiff\tif_getimage.c(1547) : warning C4550: expression evaluates to a function which is missing an argument list
C:\wx\src\tiff\tif_getimage.c(1548) : warning C4550: expression evaluates to a function which is missing an argument list
C:\wx\src\tiff\tif_getimage.c(1549) : warning C4550: expression evaluates to a function which is missing an argument list
C:\wx\src\tiff\tif_getimage.c(1550) : warning C4550: expression evaluates to a function which is missing an argument list

And

C:\wx\src\tiff\tif_compress.c(150) : warning C4761: integral size mismatch in argument; conversion supplied

These may be safely ignored. Now close the project.

Building the samples

All come with a .dsw (VC++6 project file). However, it may need amendment.

Change to c:\wx\samples\minimal, which is the "Hello World" project. Double-click on minimal.dsw.

Go to Build > Build Minimal.exe. It should build without errors. Ctrl-F5 should run the program.

Project Settings

The best way to do a wxWidgets project is to start with the nearest sample program, and just copy the whole folder, including the .dsw and .dsp. This will also have the advantage that you will always have a basic version to roll back to, in case you find a bug. (Bug reporting should always be done by trying to replicate the problem in a sample project with as few changes as possible).

If you copy the folder outside the c:\wx folder, as most people do, then you will need to amend the project settings in your new project.

Copy the splitter folder in c:\wx\samples\ to c:\work. Change to the new folder and open splitter.dsw by double-clicking on it. Now do Build|Build Splitter.

Error:

c:\work\splitter\splitter.rc(3) : fatal error RC1015: cannot open include file 'wx/msw/wx.rc'

These are the changes needed:

In Project|Settings|C/C++|General, edit the include

/I "../../include" /I "..\..\lib\mswd"

to read

/I "c:/wx/include" /I "c:\wx\lib\mswd"

In tab "Resource" change "Additional Resource directories" from

../../include

to read

c:\wx\include

In the tab "Link" change all these

..\..\lib\zlibd.lib ..\..\lib\regexd.lib ..\..\lib\pngd.lib ..\..\lib\jpegd.lib ..\..\lib\tiffd.lib ..\..\lib\wxmswd.lib

to

c:\wx\lib\zlibd.lib c:\wx\lib\regexd.lib c:\wx\lib\pngd.lib c:\wx\lib\jpegd.lib c:\wx\lib\tiffd.lib c:\wx\lib\wxmswd.lib

Save the settings with File|Save workspace and build. The project should now build with zero errors or warnings.

If you want to build in Release change all these :

..\..\lib\zlibd.lib ..\..\lib\regexd.lib ..\..\lib\pngd.lib ..\..\lib\jpegd.lib ..\..\lib\tiffd.lib ..\..\lib\wxmswd.lib

to

c:\wx\lib\zlib.lib c:\wx\lib\regex.lib c:\wx\lib\png.lib c:\wx\lib\jpeg.lib c:\wx\lib\tiff.lib c:\wx\lib\wxmsw.lib 

But be sure to compile these libs in Release before : C:\wx\src\wxWindows.dsw