Search this site

Friday, September 9, 2011

How to install wxWidgets in code::blocks

First what is wxWidget?
wxWidgets is a C++ framework providing GUI (Graphical User Interface) and other facilities on more than one platform. Version 2 currently supports all desktop versions of MS Windows, Unix with GTK+, Unix with Motif, and MacOS. An OS/2 port is in progress.

Then how?

Download wxWidgets
You can choose to download the wxWidgets source code and compile it yourself, or download the "wxPack", a precompiled version.
The wxWidgets sources are a much smaller download, but you must also spend some time compiling them.
wxPack is a much larger download, but you don't have to spend time compiling it or worry about build options.
wxWidgets Sources
The current recommended version of wxWidgets to use is 2.8.10. Click here to download the wxWidgets 2.8.10 sources for Windows (wxMSW-2.8.10-Setup.exe; 12.2 MB). You can check the wxWidgets download page to see if a newer stable version is available. It is highly recommended that you install the sources to a path without spaces. You should choose a volume with at least 300 MB of free space.

wxPack
wxPack makes the next step of building wxWidgets unnecessary. The current stable release of wxPack is v2.8.8.04, based on wxWidgets 2.8.8. Click here to download wxPack v2.8.8.04 (wxPack_v2.8.8.04.exe, 315.9 MB). You can check the wxPack download page to see if a newer stable version is available. It is highly recommended that you install wxPack in a path without spaces. You should choose a volume with at least 700 MB of free space for MSVC, or 2.2 GB of free space for MinGW/GCC.
Build wxWidgets

This step is unnecessary if you are using wxPack
Open up a command prompt for building. If you are using MinGW/GCC, simply use the standard Windows command shell (open the Start menu, click "Run...", enter "cmd" and hit OK). If you are using MSVC, you should use the special command shell which sets up the correct environment variables for you. If you use a version of MSVC which required you to download the Platform SDK separately, ensure that whichever command environment you use includes the Platform SDK tools and paths as well as the standard compiler tools and paths.

Change to the wxWidgets build directory (where is the path you extracted the sources to; typically C:\wxWidgets-2.8.9):
cd \build\msw

Execute the build command. The recommended command to use for MinGW/GCC is:
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1
The recommended command to use for MSVC is:

nmake -f makefile.vc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1

This step will generally take a long time; faster PCs may expect 30-minute build times, and slower PCs can take as much as several hours.

If using more recent versions of GCC, many warnings will occur during the build. This can slow the build process noticeably; you may want to redirect the warnings to a text file by appending "2>errlog.txt" to the build command, or supress them entirely by appending "2>nul".

See the section below titled "wxWidgets build options explained" for details on the meaning of the BUILD, SHARED, MONOLITHIC, and UNICODE options. These options are critically important, because they define the basic wxWidgets development environment you will be using. You must duplicate them exactly when running Code::Blocks' wxWidgets project wizard.

s
source : http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef

No comments:

Post a Comment