wxPack Details

wxPack Help

edit SideBar

Support This Project
SourceForge.net Logo

Current digg.com activity

Recent Changes
Printable View
Page History
Edit Page

Purpose

This document describes the procedure to use the Code::Block IDE to make a wxWidgets project. It assumes you have Visual C++ installed and correctly configured. This tutorial is a bit wordy, but please read it all because it tries to cover all the details and leave nothing out.

Using Code::Blocks Default wxWidgets Wizard

  1. Open Code::Blocks.
  2. Select File->New->Project from the menu.
  3. In the dialog that opens select wxWidgets Application and click the 'Go' button.
  4. A "wxWidgets Application" wizard will open and give you a description page. Read it and then click 'Next'.
  5. Enter your desired 'Project title'.
    Project title: wxHelloWorld
  6. Enter your desided location for the project files.
    Folder to create project in: C:\devel\programs
  7. The rest of the details will fill in automatically, but you can feel free to fill in more details if you like. Click 'Next' to go to the next screen.
  8. It asks for the location of the wxWidgets library. By default it puts $(#wx) as the location. I know it looks funny, but I suggest leaving it. The $(#sometext) syntax is Code::Blocks' way of doing Global Variables. Click 'Next' and continue.

    (More information: Using Global Variables is a good way to make your project portable. When the project it loaded and your install of Code::Block doesn't have a particular Global Variables define it will ask you for it. Kinda nice, huh?)
  9. This page wants you to select the compiler you want to use for building the project and the configurations you want to create. Choose 'Microsoft Visual C++ Toolkit 2003' or 'Microsoft Visual C++ 2005'. Leave the rest of the settings alone until you learn a bit more about how you prefer your project to build. Click 'Next' and continue.
  10. This page lets you fine tune the libraries you are going to use to build your application. Leave the settings as they came by default, except 'Create and use precompiled header (PCH)'. Un-Check it because Code::Blocks will just tell you that it doesn't support the feature with Microsoft compilers. See the list below for the exact setting used.

    Use wxWidgets DLL: Checked
    wxWidgets is built as a monolithic library: Checked
    Enable Unicode: Checked (see below)
    Use the debugging libraries: Un-Checked
    Configuration: <blank>
    Create and use precompiled header (PCH): Un-Checked

    Click 'Finish' to create your project files.

    (More information: Note for the Unicode checkbox, if you are going to use this you should know that your application will only run on Windows 2k and Windows XP.)
  11. Select Project->Build Options from the main menu.
  12. Select the main/top project target. (Not Debug or Release)
  13. In the Compiler|Compiler Flags tab check the following options:

    Microsoft Visual C++ Toolkit 2003:
    Enable C++ exception handling [/GX] : Checked
    Multi-threaded Runtime Library [/MT] : Checked
    __cdecl calling convention [/Gd] : Checked
    Microsoft Visual C++ 2005:
    Enable C++ exception handling (no SEH) [/EHs] : Checked
    Multi-threaded Runtime Library [/MT] : Checked
    __cdecl calling convention [/Gd] : Checked

  14. In the Compiler|Other Options tab type the following:
    /Zc:wchar_t-

    (More information: This setting should be in the Compiler|Compiler Flags tab, but it isn't, so we are adding it manually. The Code::Blocks developers have been notified.)
  15. Select the Linker tab and remove the wxmsw26u.lib library from the list. Leave all other libraries untouched.

    (More information: We are going to make so that the debug and Release targets build with the right wxWidgets library.)
  16. Select the Debug target.
  17. In the Compiler|Compiler Flags tab check the following options:

    All Microsoft Compilers:
    Multi-threaded DLL Debug Runtime Library [/MDd] : Checked

  18. Select the Linker tab and add wxmsw26u.lib or wxmsw28u.lib library to the list depending of if your are using wxWidgets version 2.6 or 2.8 respectively.

    (More information: Notice the 'ud' on the library name, the 'u' stands for Unicode and the 'd' stands for Debug. You will only need the 'd' if you did NOT select Unicode in the project wizard.)
  19. Select the Release target.
  20. In the Compiler|Compiler Flags tab check the following options:

    All Microsoft Compilers:
    Multi-threaded DLL Runtime Library [/MD] : Checked

  21. Select the Linker tab and add wxmsw26u.lib or wxmsw28u.lib library to the list depending of if your are using wxWidgets version 2.6 or 2.8 respectively.

    (More information: Notice the 'u' on the library name, the 'u' stands for Unicode. You will only need the 'u' if you selected Unicode in the project wizard.)
  22. Select OK to close the 'Build Options' dialog.

You are done! Both the Release and Debug targets should now build and run.

Page last modified on April 17, 2007, at 01:06 PM
Theme by Theron Parlin - wiki