How to Add Boost Library to Code::Blocks in Linux

How to install Boost libraries with CodeBlocks?

From the error message you posted I assume you're using some version of Visual Studio. In order to use its compiler from the command line you need to define a few environment variables. This is done automatically for you if you use the Visual Studio command prompt. Better yet you might want to try and follow this tutorial.

How do I build Boost libraries on Code::Blocks (Windows)?

"How do I, then, build separately the non-header-only libraries?"

If you are using MinGW for example as your compiler choice then open up a command prompt, navigate to the boost root directory that you downloaded/extracted and run the bootstrap.bat command in the following manner:

bootstrap.bat mingw

b2.exe

Running the bootstrap command will generate the MinGW-related library files (defaulting to the stage/lib subdirectory) that you will need to link to within Code::Blocks, which will include the one you needed for Boost.Threads for example:

Sample Image

And then in CodeBlocks you will need to

  1. Set the location of the Boost root directory in the Search
  2. Select the Linker tab and set the location of the library files
  3. Select the Linker Settings tab add the necessary library names eg

See this link for more screenshots and explanations:

http://www.technical-recipes.com/2014/configuring-codeblocks-to-use-the-boost-libraries/

Building boost libraries with Code::Blocks

From A beginner's quick reference for setting up Boost with Code::Blocks in Windows:

Bootstrap.bat assumes you are using msvc compiler, to use Gcc, type

bootstrap.bat gcc

How do I include the Boost library (version 1.58) to Code::Blocks?

Basically you download the boost library.

Then you build it.

And after that you have your lib folder etc. which you can include.

Just read the Guide for Windows or the Guide for Unix

Set up Quantlib in Code Blocks on Fedora 25

I haven't used Code::Blocks, but the steps should be the same as for any other library; include in your sources the headers for the features you want to use, link the library with your compiled source, and make headers and libraries available to the compiler.

Starting from the end: the RPMs might have already installed QuantLib header files and libraries where the compiler can find them, so you probably won't have to worry about it. If that's not the case, find out where the RPMs installed QuantLib: headers and libraries might be in /usr/include/ and /usr/lib/, or /usr/local/include and /usr/local/lib. Add the include directory (which must contain the ql folder) to the include search paths for Code::Blocks, and the library directory (which must contain libQuantLib.*) to the library search paths.
The page at http://wiki.codeblocks.org/index.php/BoostWindowsQuickRef shows how to do it for Boost (look under the section "Add Boost search directories to your project"); you can do the same for QuantLib.

Once the search directories are set up, you have to include in your sources the QuantLib headers you need; for instance;

#include <ql/time/date.hpp>

if you want to use the Date class. Finally, add QuantLib to the list of libraries to link to your project. Again, this is done in the same way described for Boost on the page I linked above; look at the section "Include Boost headers and link with Boost libraries".



Related Topics



Leave a reply



Submit