|
Many IDEs and compilers are available for Windows. The dominant IDE on Windows is Microsoft Visual Studio; wxWidgets requires at least Visual Studio 5. Microsoft has released Visual Studio 2005 Express for home enthusiasts and students, and it features all of the common Visual Studio tools, omitting only the high-powered tools typically used in large projects or a corporate environment. Although it is a free beta download at the time of writing, it will cost around $50 once it is officially released. See http://lab.msdn.microsoft.com/vs2005/. You must have the Windows Platform SDK installed in order to build wxWidgets, which is a free download from http://www.microsoft.com/msdowload/platformsdk/sdkupdate. When using the Platform SDK and the free compiler, install both the Core and Internet modules, and build wxWidgets with the run-time library linked statically (pass RUNTIME_LIBS=static to make or set Runtime Linking to Static in your DialogBlocks configurations). If using a project file, you will need to modify this setting manually, both in the wxWidgets and application project files. You may also need to remove the library odbc32.lib from the linker settings because the Platform SDK does not contain this library. The SDK is already included with any of the professional versions of Visual Studio. Regardless of which version of Visual Studio you are using, the process for building wxWidgets is the same. From your wxWidgets installation, open the wx.dsw workspace from the build\msw directory. If you are using a version later than 6.0, you may be prompted that the sub-projects must be converted to the current Visual C++ project format. Allow Visual Studio to proceed with the conversion; if you need the files in their original format, you can always extract the originals again. After all the projects in the workspace have been opened, you can browse the sources and classes. If you are using Visual C++ version 7 or 8 (.NET or 2005), build wxWidgets by selecting Build Solution from the Build menu. Different solutions are used to build different library configurations, selectable from the Configuration Manager from the Build menu. Simply select which configuration you want to use, such as Debug, Unicode Release, or DLL Unicode Debug. If you are using Visual Studio 5 or 6, build wxWidgets by selecting Batch Build from the Build menu and checking the desired library configurations. The wxWidgets project is set up to allow building release and debug versions of both Unicode and non-Unicode libraries, both static and shared (DLL). Ensure that you are building all of the sub-projects for the configurations that you want to use. Most developers only need to build the release and debug libraries, or if you have a need for Unicode, the Unicode release and Unicode debug libraries. As a rule, using the static (non-DLL) libraries makes it easy to distribute a single-file application rather than needing to also distribute (or otherwise require) the correct wxWidgets DLL. Using the DLL builds can also result in quirks relating to application startup, so they should be used only when needed and only if you have a thorough understanding of how DLLs are utilized by both wxWidgets and Windows. The compiled library files are placed into the lib directory under your wxWidgets directory. Two directories are created: vc_dll and vc_lib, for the shared and static builds, respectively. If the process of building via project files seems fiddly (the number of configurations in the project file can be confusing!), consider using the command-line alternative as described in the section "WindowsMicrosoft Visual C++ Command Line," or build wxWidgets via DialogBlocks. Compiling a wxWidgets Sample ProgramWorkspace and project files are included for every wxWidgets sample. Use Visual Studio to open a workspace for one of the samples (in the samples directory within your wxWidgets installation), and then select a configuration matching any of the wxWidgets library builds that you compiled. For example, if you have built the Unicode debug library, compile the sample using the Unicode debug build. The samples are created to look within the wxWidgets tree for the include and library files in their default locations. As long as the library built successfully and the structure of the source tree hasn't been altered, the samples will build successfully as well. Note If you built wxWidgets and a sample from the command line, as described in the next section, trying to run and debug the sample in Visual Studio may result in a question about rebuilding libraries. Answer No to this question to continue running the sample. |
|