How to get started with wxWidgets on Windows

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

6 thoughts on “How to get started with wxWidgets on Windows

  1. Thanks! Just tried that with wxwidgets 3.0.2 and VC++ 2013 Express and I can confirm that it works. Do note that the lib and include directories are project-specific as opposed to globally specified (aka : the previous iterations of VC++). Took me a while to figure out, but there. They should be found by right clicking on the project tab (not solution!) -> properties -> configuration settings -> VC++ directories

    Like

  2. Hello
    I’m also using Visual Studio 2013 with Windows 7 x64 and I have few questions:
    1. Since I have x64, do I have to change in Configuration Manager to x64
    2. I’m having some problems when building mostly:
    β€œfatal error C1083: Cannot open include file: β€˜windows.h’: No such file or directory”
    Can you please explain to me the way to fix it
    I’m currently working on a project and I need to figure this out today so I can start working on the GUI
    Thanks

    Like

  3. Got this working in VS 2017 and wxWidgets 3.0.3. Slight modification since the 2017 project wizard has changed, once you create the windows console application, and have added all the DIR and LIB directories, you need to also alter the Linker->System->SubSystem to Windows(/SUBSYSTEM:WINDOWS), in the application property pages.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.