From NoskeWiki
Jump to navigation Jump to search

About WxWidgets

WxWidgets is a free open-source cross-platform widget toolkit for C++.

This seems to be the best FREE toolkit to create GUIs in C++, but it's a BIG library and I have found it can be buggy on a Mac. In my opinion the Qt toolkit is better, but is commercial unless for educational applications.

Installation on Windows

To install on windows:

  • Download the latest version of "wxMSN" from the WxWidgets homesite.
  • Run the self installer.
  • Set the User Environment Variable "WXWIN":
    Right click My Computer >> Properties >> Advanced >> Environmental Variables, and if it doesn't exist enter a new variable "WXWin" as "C:\wxWidgets-2.8.9".

To compile using Microsoft Visual Studios:

  • Open the file "include/wx/msn/setup.h" and check settings are desired.
    • NOTE: in my case I always change the line "#define wxUSE_GLCANVAS 0" to "#define wxUSE_GLCANVAS 1" because I use OpenGL in most of my projects.
  • Open the file "build/msn/wx.dsw" in Microsoft Visual Studios.
  • Go: Build > Batch Build > Select All > Build.
    • This takes a LONG time - several hours - and occupy >5GB of space - which is why it's important to get it right the first time.
    • If you get lots of errors repeat this step a few times (it will be quicker each time) until errors are minimized.
  • You can now open samples (either through "samples/samples.dsw" or one of the subfolders) and compile them together or individually.
    • When creating a new wxWidgets project it's a good idea to start with a sample project (the one most similar to what you want).

To make a new wxWidgets MSVC project:


To create a new project from a sample

  • Find the most appropriate sample (eg: "minimal") and delete/clean unnecessary files.
  • Renames all files from "minimal" to "myapp" (the name of your choice).
  • Open ALL files in notepad and replace all occurrences of "minimal" with "myapp" ... save and close.
  • Open myapp.vcproj and myapp.sln, find all paths with "../.." and "..\.." and replace with the absolute path to your wxWidgets install (eg: "C:\wxWidgets-2.8.1") ... save and close.
  • Open myapp.sln in Visual Studio .NET, add your source files to the project and build.