Getting Started with wxWidgets

From WxWiki
Jump to: navigation, search
Crystal Clear action configure.png This project page or section is in the middle of an expansion or major revamping.
You are welcome to assist in its construction by editing it as well.
Crystal Clear action configure.png

Those who are new to wxWidgets would normally follow the steps illustrated below:

WxGettingStartedRoadmap.png

In short, these steps are:

  • Choose and install your development environment.
  • Either download pre-built libraries of wxWidgets, or download the source code and build it yourself.
  • Build one of the sample projects that ship with wxWidgets (e.g. \wx288\samples\minimal).
  • Write and compile a simple Hello World application.
  • Write and compile your own application.


Choosing and Installing an IDE\Compiler

wxWidgets supports a multitude of compilers and IDEs. Your choice is most likely to be based on two main factors:

  • The tools you are familiar with already
  • What platforms you plan to develop for

To give two of many examples, those who only wish to develop for Windows only might choose to solely use the free Microsoft VC IDE; those who wish to develop for Windows, OS X and Linux, might choose gcc (and MingGW) to build the wx libraries and CodeLite to build their applications.

See the list of IDEs for more details.

The WX Libraries

Should I Download or Build the Libraries?

Most developers download the code and build the libraries themselves. Yet, a few pre-built libraries for certain platforms are available.

Why do I need to compile the library myself?

Because wxWidgets supports so many different platforms, compilers, and compile-time options, it would just not be practical to provide pre-compiled libraries for every possible combination.

How long does it take to build the libraries?

  • Understanding the various aspects involved in building the wxWidgets libraries should take between 20-60 minutes. You would find it easier if you understand terms like DLL, Unicode, TIFF and debug\release.
  • Building it just to get you going, while depending on your machine and configuration, would take on avarage 20 minutes.

What are the advantages in building the libraries myself?

  • You will be able to choose:
    • which libraries to build
    • their configuration
    • what to include and what to exclude (you might not need certain library components, might need ones that are not included by default)
  • If you are ever to distribute your application, you are most likely to want to be able to control the aspects mentioned above; such a practice will also yield a smaller executable.

So why might I choose to download pre-built version?

Those who only wish to quickly try wxWidgets might want to save the time involved in building the libraries.


Downloading the wxWidgets Source Code

See Downloading and installing wxWidgets.

Building wxWidgets

First, make sure you read Understanding wxWidgets Build Scheme.

Building wxWidgets with Visual Studio 7 or later

  • Navigate to the wxWidgets\build\msw folder and open the solution file (.sln) for your version of Visual Studio.
  • Select the Platform and Configuration you wish to build
  • Choose Build Solution (Build menu or toolbar or F7)
  • Add the WXWIN Environment variable

Downloading the Pre-built Libraries

For Windows: see the wxPack project at sourceforge

Compiling the Samples

The following paragraphs describe compiling the samples included in a standard wxWidgets install on various systems.

Visual C++

To compile the samples go to the 'samples' subdirectory in the directory where you installed wxWidgets. In this directory open the file samples.dsw (VC6) or samples.sln (Visual C++ 7 or later).

Once opened make sure that 'class view' is enabled. To enable class view select it from the Main-menu->View->Class-View. In the class view pane right click the project named 'Minimal' and select 'Set as Startup Project' from the context menu (popup menu). You can now press F5 to build and run the minimal project. If everything is well a window should popup.

Have fun doing the same with the other projects in the list and see what wxWidgets is capable of.

See Also

Creating a new project from a sample

Create a project based on a sample using Visual Studio 2013 Express

Creating a new project by hand