Of CodeLite and Boost libraries

The fastest way to start writing wxWidgets and C/C++  code is to get the CodeLite IDE. Its open source, free and supports multiple OSes. And add the Boost C++ library into the mix, you can build some really good cross-platform applications. While, wxWidgets comes pre-configured with CodeLite installer ,  for Boost,  we need to manually link up stuff.

Here’s the clear and up-to-date information on how to setup boost with codelite, in Windows.

Before we begin:

  1. Download the “CodeLite 5.4 Installer for Windows (8, 7, Vista and XP) with MinGW TDM-GCC 4.8.1 included”  package located here(
  2. Download a suitable version of “7z for Windows” from here( and Install it on your system. I recommend 7-Zip 9.20 version.
  3. Download boost sources, available as “boost_1_55_0.7z” from here.(

Now, follow the following steps:

    1. Extract the codelite-5.4-mingw4.8.1.exe file from the codelite-5.4-mingw4.8.1.exe.7z file, that you just downloaded and run the setup.NOTE: You must install codelite to a path that does NOT contain any spaces or parentheses, eg: C:\mycodelite
    2. Extract the boost_1_55_0.7z to a path that does NOT contain any spaces or parentheses, eg: C:\myboostdir
    3. Tell CodeLite where to find boost libs:
      Go to Settings > Build Settings… > Compilers Tab
      Select the “gnu g++” option and click on the plus sign to expand the option >
      Select “Advanced”
      In “Include Paths” textfield, add the path where the boost libs would be available, in this case:
      In “Libraries Paths” textfield, fill in the path above, i.e. C:\myboostdir.
      Click “Ok” and close the dialog box.
    4. In CodeLite , Press Alt+W and then N, to Create a New workspace.
      In the “New Workspace” dialog box, fill in the “Workspace name” and select a proper path for the project.
      Again, preferably the project path should not contain any spaces and parentheses.
      Press the “Create” button.
    5. Then, in the new workspace, press Alt+W and then P,to Create a new project.
      In the “New Project” dialog box, select the Template->Console->Simple executable(g++) and fill in a project name in the “Project name” field and click on “Ok”.
    6. In the workspace view, select the main.cpp file and paste the below code.

      #include <boost/lambda/lambda.hpp>
      #include <iostream>
      #include <iterator>
      #include <algorithm>

      int main()

      using namespace boost::lambda;
      typedef std::istream_iterator in;
      in(std::cin), in(), std::cout << (_1 * 3) << ” ” );
      return 0;


    7. Press F7 to build the project.
      * If you see no build errors, you’re good to go, to the next step.
      * If you see 1 or 2 warnings, especially pertaining to the boost headers, ignore them. (Reference: else you should look at the steps 1 to 5 above again.
    8. To test your application, open a cmd window:
      * Press Win + R . In the Run dialog box, type in “cmd”, without quotes and press enter.
      * cd to the directory where the project was created in.
      * cd to the Debug directory.
      * Run the executable file in that directory as follows:codelite test

If you get the output as in image above, you have setup codelite correctly, so far. If you don’t check the code carefully or review the steps 1 to 7.

Now, if you want to use any of the separately-compiled Boost libraries, you’ll need to build and install it. To do this:

    1. Go to the directory tools\build\v2\
    2. Run bootstrap.bat
    3. Run b2 install –prefix=PREFIX where PREFIX is the directory where you want Boost.Build to be installed, eg: C:\myboostdir\builddir
    4. Add PREFIX\bin to your PATH environment variable.
    5. Then, cd to the Boost root directory(C:\myboostdir) and invoke b2 as follows:
      b2 -j 4 toolset=gcc link=static --with-system --with-thread --with-date_time --with-regex --with-serialization stage debug

      NOTE:The above b2 command will setup basic libraries to use with boost.asio.
      If you intend to build the complete set of libraries, you should run(This may take about 2-3 hours or more, depending on computer hardware specs):
      b2 -j 4 toolset=gcc --build-type=complete stage
      To see an exhaustive list of options, refer: documentation at
    6. Go to the workspace view and there select your “Project” and right-click on it. Go to the “Settings” menu item. In Settings dialog box, edit the “Library Paths:” and the “Libraries:” as shown in the screenshot below.
      codelite settings
      Press “OK” and close the dialog box.
    7. Replace the code in the main.cpp with the one below:
      #include <boost/regex.hpp>
      #include <iostream>
      #include <string>int main()

      std::string line;
      boost::regex pat( “^Subject: (Re: |Aw: )*(.*)” );
      while (std::cin)

      std::getline(std::cin, line);
      boost::smatch matches;
      if (boost::regex_match(line, matches, pat))
      std::cout << matches[2] << std::endl;


      return 0;


    8. Press F7 to build the project.
    9. In the open cmd window, cd to the directory where the project was created in.
      * cd to the Debug directory.
      * run the executable file in that directory as shown in the screenshot below:
      boost and codelite

If you see the output as shown above, you have a working boost + codelite system. Congratulations!

Please do drop in a comment and let me know how it goes.