hello, I'm trying to install and use boost graph library file sin my code blocks IDE for C++ program but am unable to.Please help.

Recommended Answers

All 7 Replies

All you need to do, since BGL is a header-only library, is to add the include directory for boost in your CB project.

First, of course, you need to have installed Boost libraries, by following the instructions on the www.boost.org Getting Started page.

After that, you should have boost installed to some directory that you specified.

Then, in CB, you go to project/build-options and add, under include directories, the boost/include directory from where your boost installation was done. Then, all should be fine.

All you need to do, since BGL is a header-only library, is to add the include directory for boost in your CB project.

First, of course, you need to have installed Boost libraries, by following the instructions on the www.boost.org Getting Started page.

After that, you should have boost installed to some directory that you specified.

Then, in CB, you go to project/build-options and add, under include directories, the boost/include directory from where your boost installation was done. Then, all should be fine.

how do I add library?The boost folder doesnt have any .lib or .dll file..

BGL is header-only, it does not require a library (at least, I think so).

If you do need to link to boost libraries, you need to follow the instructions on the boost website to build the libraries using MinGW GCC. That must be done in command-line (command prompt), using Boost's build system (BJam).

Normally, the libraries get installed into "boost_install_folder/lib/stage/". And, depending on the options you use for the build, they will have either .a or .lib extensions.

If you need to use the libraries for another compiler (like the microsoft compiler), you will need to build them with that compiler as well.

I installed using Boostpro installer.I did add the library files in the linker settings yet while debugging , i get the error "no such file or directory" for g2++.h and every other file.

g2++.h is not part of Boost, it is part of the g2 library. That problem is not related to Boost, since Boost does not contain external dependencies (especially not from such dubious source) except for the standard libraries. Additionally, I find it bizarre to have a file name that includes ++ in its name, some operating systems might not even be able to find it just because of the odd characters in the filename.

Just try to compile a simple BGL example from the tutorials and see if that works. That should tell you if your Boost installation is correct.

If you are using, alongside, other external libraries, and that some of those use this g2 library, deeming it OK to do so, it means you will most probably have further problems with that external dependency (Boost installation will be the last of your worries).

okay let me put it this way.
I linked .dll files from lib folder of boost in the linker add section of CB
Then i tried to compile a simple BGL code with header file "boot/adjacency_list.h"
It gives the error no such directory found.
Please give a step by step procedure as to how to go about it.I'm stuck!!

You need to also specify the "include directory" of boost, not just the link directory. The headers (such as adjacency_list.h) are in the boost include directory, not where the libs are. BTW, I'm pretty sure you need to include "boost/graph/adjacency_list.h"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.