This page describes the steps needed to compile the wxWidgets library for Windows.
We used for this step the Microsoft Visual C++ Express 2010/2013 as mentioned in the prerequisites page
Get wxWidgets archive for Windows. wxWidgets 3.0.x is tested and works. Go to wxWidgets downloads page for this.
Unzip the archive into a directory containing no spaces to avoid some possible issues. For example C:\Code\wxWidgets3.0
Set the environment variable WXWIN to the wxWidgets path C:\Code\wxWidgets3.0
Go to "build/msw" directory from the place where data is extracted. Open a solution (.sln) that matches your version of Visual C++:
- VS 2010 - wx_vc10.sln
- VS 2012 - wx_vc11.sln
- VS 2013 - wx_vc12.sln
Opening with a newer version of Visual C++ asks for conversion which should work fine.
NOTE: You should use the SAME version of visual studio you use to compile the Code Trainer! If you won't you will get link errors!
We recommend you to compile DLLs. "DLL Debug" and "DLL Release" configurations should be built. Please choose the Win32 platform - this is the platform we'll use for CodeTrainer framework for all its sources and external libraries.
There may be a problem when building (LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt) that can be caused by:
- This issue for Visual Studio 2012 http://stackoverflow.com/questions/10888391/error-link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-inval Try using VS Express 2013 for Windows Desktop
- Dependency problems - this can be solved by trying "Build Solution" multiple times until no more errors appear
To build the "DLL Debug" configuration, select "DLL Debug" configuration (and Win32 platform). After that right click on the solution and select "Build".
There's nothing to Run (CTRL+F5) or Debug (F5) here. wxWidgets is just a set of libraries that can be used to create Graphical User Interfaces (GUIs).
The same thing should be done for "DLL Release" configuration.
We are using debug/release DLLs for the project and currently the build script (scripts\windows\buildall.bat) compiles a debug version of the framework using Debug DLLs of wxWidgets.
Reasons for using dynamic libraries
Using static libraries makes huge executables but with no DLL dependencies. This may avoid what is called the DLL Hell but:
- Using static libraries in multiple DLLs that are using wxWidgets functions makes duplicate code/variables
- One of the problems encountered here is that some controls defined in DLLs may not have a parent since there are some global variables that are instanciated twice while there should be only one instance
- Your code will not benefit from improvements of the library if statically compiled. This means that if you change the DLLs with an improved (and compatible) version your application will run and benefit from the improvements.
Please check the "DLL Hell" wikipedia page for more information.