wxWidgets & Visual C++

Cekli PhotoLab software is developed using both wxDevC++ and Microsoft Visual C++ 2005. wxDevC++  is integrated with wxWidget, there fore the set up is done automatically. This article will explain how to use Visual C++ 2005 as IDE for Cekli PhotoLab code.

After installing Visual C++ 2005, we can download the wxWidget library for Visual Studio at http://www.wxwidgets.org/downloads/. Choose installer for windows (wxMSW) and install it on the default directory (c:\wxWidget-2.x.x\). The library must be compiled first before we can use it, it is very simple. The following steps are explained about how to compile the wxWidget library's source code:

  • Open the file wx.dsw (we use static library not dynamic wx_dll.dsw) at c:\wxWidget-2.x.x\. Click Yes to All to convert the current files from version 6.0 to 2005.
  • We need both build as release and debug, there fore we need to compile it in both build setting (debug and release).Click debug and in Solution explorer, right click one of the project and click Build, do it one by one with the following project order.
  1. wxjpeg
  2. wxpng
  3. wxtiff
  4. wxzlib
  5. wxregex
  6. wxexpat
  7. base
  8. net
  9. odbc
  10. xml
  11. core
  12. gl
  13. html
  14. media
  15. qa
  16. adv
  17. dbgrid
  18. xrc
  19. aui
  20. richtext
  • Change the setting to release and build one by one with the same order above.

The complete documentation of using Visual C++ 2005 as IDE for wxWidget source code can be found in this link. At this point, you should able to compile every sample code at folder C:\wxWidgets-2.x.x\samples.

Folder Structure

The source code and the output files are separated on the local computer. Only the source code will always be updated on the subversion server at www.sourceforge.net.
The source code on my local computer are at:


The output code are on:

C:\Output\CP_VC2005 for execute and all Visual studio stuff and 

C:\Output\PhotoLab for execute and all wxDevC++ stuff.


Creating a New Project by Hand

The main things to worry about with project settings are the C runtime library, preprocessor definitions, additional include directories, libraries that your program needs, libraries that wxWidgets needs, and the disabling of certain default libraries to resolve symbol conflicts that might occur.

Start with a Visual C++ Win32 Project and accept the default settings.

Project Properties

Character Set
Select Not Set, Unicode, or Multi-Byte depending on what you need.


Category: General
Additional include directories:
Specify the location of the wxWidgets include directory
Specify the location of the Setup.h file. You need to match it up with the wxWidgets library you are linking with. Here's the rundown: Directory Basic wxWidgets libraries Description
lib\vc_lib\msw wxmsw28_core.lib wxbase28.lib release ANSI static
lib\vc_lib\mswd wxmsw28d_core.lib wxbase28d.lib debug ANSI static
lib\vc_lib\mswu wxmsw28u_core.lib wxbase28u.lib release Unicode static
lib\vc_lib\mswud wxmsw28ud_core.lib wxbase28ud.lib debug Unicode static

Detect 64-bit Portability Issues: Select No to avoid warning messages on strings.
Category: Preprocessor:

Preprocessor definitions:
Add WINVER=0x0400
For projects using GUI components add wxUSE_GUI=1
Add __WXDEBUG__ for debug builds that link to wxWidgets debug configurations. Activates wxASSERT(), etc. See the Debugging Overview for more information.

Category: Code Generation

For the C runtime library, use the Multithreaded DLL for release and Debug Multithreaded DLL for debug builds, as the multithreaded DLL libraries are the ones wxWidgets is linked with by default. If you get something like:
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBC.lib(free.obj)

then you're linking with the wrong runtime library.
Category: Precompiled Headers

See the Tips'n'Tricks section of the wiki for setting up precompiled headers

Category: General

Additional Library Directories
Specify the location of the wxWidgets lib directory

Category: Input

Add comctl32.lib rpcrt4.lib winmm.lib advapi32.lib wsock32.lib. wxWidgets needs these.
Add any of these that you need:
Release: wxpng.lib wxzlib.lib wxjpeg.lib wxtiff.lib
Debug: wxpngd.lib wxzlibd.lib wxjpegd.lib wxtiffd.lib
Add one of the wxWidgets libraries from the table above

Trackback URL for this post: