Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to get started with wxWidgets on Windows

📅 2013-Dec-16 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ visual studio, windows, wxwidgets ⬩ 📚 Archive

wxWidgets is a cross-platform GUI library, that is also available for Windows. You can get started with using wxWidgets in a few steps:

  1. Download and install the Windows installer for the current stable release of wxWidgets from its download page. It installs the source and build files in C:. For example, in C:\wxWidgets-3.0.0\

  2. wxWidgets needs to be built before it can be used with your application. Go to C:\wxWidgets-3.0.0\build\msw and open the .sln file that matches the Visual Studio version you intend to use for your application. For example, I open wx_vc10.sln using Visual Studio 2010.

  3. Choose one of the build types: Debug, Release, DLL Debug or DLL Release and build the solution. The resulting .lib files are placed in C:\wxWidgets-3.0.0\lib\vc_lib

  4. Create a new Visual Studio solution for your C++ application. Remember that it has to be Win32 Project, not a Win32 Console Project. The difference is that the main function is defined inside wxWidgets and does not need to be defined in your application code.

  5. Add a .cpp file to your solution and copy the Hello World code into it.

  6. Add C:\wxWidgets-3.0.0\include and C:\wxWidgets-3.0.0\include\msvc as additional include directories to the solution.

  7. Add C:\wxWidgets-3.0.0\lib\vc_lib as additional library directory to the solution.

  8. Build the solution and run it to see an empty wxWidgets window.

Tried with: wxWidgets 3.0.0, Visual Studio 2012 and Windows 7 x64