User forums > Help
Using Boost in Code Blocks
maxim6394:
I'm trying for quite a while now to use the boost libraries in code blocks, but I always get the error "no such file or directory" when I try to include a .hpp file from the boost directory. I'm using MinGW with boost included. I created a new variable in code blocks named "boost", with the base path pointing to the include/boost/ directory of the minGW installation. The wiki page says I have to add "stage\lib" in the lib field but that subdirectory doesn't exist.
Any indeas?
BlueHazzard:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
maxim6394:
I am running Code::Blocks version 13.12 on Windows 7. The compiler I use is MinGW GCC version 5.1.0.
When I try to use the Boost library in my project, the files aren't found. I tried to follow the steps on the wiki page, I also tried to build the boost library but I only get this error:
--- Code: ---O:\developement\CPP\boost_1_46_1\boost_1_46_1>bootstrap.bat --toolset=gcc "--pre
fix=C:\asdf\" install
Building Boost.Jam build engine
Der Befehl "cl" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
Failed to build Boost.Jam build engine.
Please consult bjam.log for furter diagnostics.
You can try to obtain a prebuilt binary from
http://sf.net/project/showfiles.php?group_id=7586&package_id=72941
Also, you can file an issue at http://svn.boost.org
Please attach bjam.log in that case.
--- End code ---
I thought it wasn't necessary to build the library because it's already included with the compiler, but I still don't really know how to use it.
Build log:
--- Code: ---
-------------- Build: Debug in Project3 (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -fexceptions -g -std=c++11 -IC:\Qt\5.5\msvc2013_64\include -IO:\developement\CPP\boost-1.30.1\boost-1.30.1\include -IC:\MinGW\MinGW\include\boost -IC:\Users\maxim\Documents\Development\CPP\cpp_project\Project3 -c C:\Users\maxim\Documents\Development\CPP\cpp_project\Project3\main.cpp -o obj\Debug\main.o
C:\Users\maxim\Documents\Development\CPP\cpp_project\Project3\main.cpp:4:25: fatal error: boost/asio.hpp: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minute(s), 7 second(s))
1 error(s), 0 warning(s) (0 minute(s), 7 second(s))
--- End code ---
scarphin:
So you are using MinGW as your compiler and Visual Studio compiled binaries for Qt:
--- Code: ----IC:\Qt\5.5\msvc2013_64\include
--- End code ---
Do you have a reasoning for that?
From what I see from your build log:
--- Code: ----IO:\developement\CPP\boost-1.30.1\boost-1.30.1\include
-IC:\MinGW\MinGW\include\boost
--- End code ---
you should have the file:
--- Code: ---O:\developement\CPP\boost-1.30.1\boost-1.30.1\include\boost\asio.hpp
--- End code ---
or
--- Code: ---C:\MinGW\MinGW\include\boost\boost\asio.hpp
--- End code ---
Do you have either one of these files? If not, then you're not including the correct paths.
If your compiler includes boost why are you using a separate boost installation?
Also please don't ask boost (or any other library) related questions here. None of those are supported nor allowed unless it's a CodeBlocks related problem.
Btw current boost version is 1.58 or something, why do you use such old boost versions (1.30, 1.46)?
maxim6394:
I think I finally got it. I tried the included libray and also tried to build the seperate installation and neither worked.
Adding "C:\MinGW\MinGW\include" to the search path for the project apparently was the solution, I think I only tried including "C:\MinGW\MinGW\include\boost", which didn't work.
The subdirectory \boost-1.30.1\include\ doesn't even exist and also the boost.org website is unreachable for me, I only get a connection timeout so I got the files somewhere else.
Navigation
[0] Message Index
[#] Next page
Go to full version