Code::Blocks
User forums => Help => Topic started by: kanesoban on July 08, 2008, 10:26:56 pm
-
Helo,
my problem is the following: there are some things i want to use in the boost/filesystem library.
http://www.boost.org/doc/libs/1_35_0/libs/filesystem/doc/index.htm
However, i have no idea, how to install 3rd party libraries. I've read through boost's website, but it mostly contains instructions on installing boost with Ms Visual Studio. With other IDEs, the site says, that
"if you're using an earlier version of Visual Studio or some other compiler, or if you prefer to build everything yourself, you can download boost_1_35_0.exe and run it to install a complete Boost distribution"
There is a link to the sourceforge boost page, but there is no exe to download.
-
There is a link to the sourceforge boost page, but there is no exe to download.
Probably you are just a bit too early? I didn't even realise that boost 1.35.0 is out... :shock:
-
note not everything from boost needs to be build Several things are just simple templates in header files, no idea about the filesystem, never used that part
By the way : in linux you get a free ride, most distros have it as a package : binary and headers :-)
Longe live linux :-) :-)
-
The documentation is in error; an .exe is no longer distributed. You can download whichever of the archives on the SourceForge download page is easiest for you to extract.
boost::filesystem does indeed need to be built. Follow the directions here (http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html#or-build-binaries-from-source). You haven't specified which compiler you're using, so I'll assume it's the installation of MinGW included with the full Code::Blocks 8.02 download. Your toolset, for the purposes of building Boost, is "gcc". You will need to ensure the "bin" subdirectory (containing gcc.exe and friends) is in the PATH environment variable before invoking bjam.
Cheers,
John E.
-
"You haven't specified which compiler you're using"
It's gcc 3.4.4.
"You will need to ensure the "bin" subdirectory (containing gcc.exe and friends) is in the PATH environment variable before invoking bjam."
How do i do that ?
-
You can do it permanently by adding it in the Environment Variables applet (Control Panel / System / Advanced / Environment Variables). A "Path" entry is usually already present, and you can just tack ";C:\MinGW\bin" on to the end of it (assuming MinGW is installed in C:\MinGW).
Or you can do it for the length of a single command prompt session with:
set PATH=%PATH%;C:\MinGW\bin
You will also need to do this for the path to bjam.exe, unless you put it in the root of the Boost sources.
A final note:
Questions like this are not truly appropriate for the Code::Blocks forums. If you have further difficulties, you should use the MinGW or Boost mailing lists.
-
Helo again,
i think i succesfully built boost. Now, the next question is, how do i link it in Codeblocks to my program ?
Note:
boost build directory is C:\Documents and settings\Kane\build-boost\
-
Now, the next question is, how do i link it in Codeblocks to my program ?
* Add whatever folder contains the boost/*.hpp files to your project's include search directories.
* Add whatever folder contains the library files you just built to your project's library search directories.
Then you can add the name of the library you want to link in your project's libraries to link.
-
* Add whatever folder contains the boost/*.hpp files to your project's include search directories.
* Add whatever folder contains the library files you just built to your project's library search directories.
Please write this down in simpler steps, and more detail.
-
Depending on how you've run bjam, the full path to filesystem.hpp will be like "DriveLetter:\Path\To\SomethingWithBoostInIt\include\boost_1_35\boost\filesystem.hpp". In this case, add "DriveLetter:\Path\To\SomethingWithBoostInIt\include\boost_1_35" in the list of directories in the Compiler tab of the Search Directories tab of your project's Build options.
Also depending on how you've run bjam, the full path to libboost_filesystem-1_35.a will be like "DriveLetter:\Path\To\SomethingWithBoostInIt\MaybeLib\libboost_filesystem-1_35.a". In this case, add "DriveLetter:\Path\To\SomethingWithBoostInIt\MaybeLib" in the list of directories in the Linker tab of the Search Directories tab of your project's Build options.
Then, add "boost_filesystem-1_35" to the list of libraries to link in the Linker tab of your project's Build options.
Obviously, you'll have to do a smidge of creative thinking in order to figure out exactly what paths to use. The name of the library file might even be wrong. This is because A) I'm not at a computer with Boost installed, and B) if you can't figure it out, then there are some basic programming concepts you need to learn first.
-
Could you give more details on
some basic programming concepts
? :lol: :lol: :lol:
-
Sure. In this case, there are two that apply:
1. RTFM! The boost documentation tells you about the various libraries that are built and how to use them.
2. Understand your compiler! You need to grasp of the concepts of compile-time and link-time resolution and what files and commands the compiler needs in order to perform them. See (1) as applied to the compiler documentation, take a class in C or C++, or read a book.
And that's as detailed as is appropriate for the Code::Blocks forums.
Cheers,
John E.
-
...add "DriveLetter:\Path\To\SomethingWithBoostInIt\include\boost_1_35" in the list of directories in the Compiler tab of the Search Directories tab of your project's Build options.
Done.
Also depending on how you've run bjam, the full path to libboost_filesystem-1_35.a will be like "DriveLetter:\Path\To\SomethingWithBoostInIt\MaybeLib\libboost_filesystem-1_35.a". In this case, add "DriveLetter:\Path\To\SomethingWithBoostInIt\MaybeLib" in the list of directories in the Linker tab of the Search Directories tab of your project's Build options.
Strange. There is no such file on my entire hard-drive. Maybe i didn't succeed in building boost after all ?
Then, add "boost_filesystem-1_35" to the list of libraries to link in the Linker tab of your project's Build options.
Done.
Now, the compiler gives this message when i try to build my project:
C:\Program Files\CodeBlocks\bin\..\lib\gcc\mingw32\3.4.4\..\..\..\..\mingw32\bin\ld.exe: C:\Program Files\boost\boost_1_35_0\libs: No such file: Permission denied
-
Strange. There is no such file on my entire hard-drive. Maybe i didn't succeed in building boost after all ?
That might be so.
At any rate there should be a directory somewhere full of Boost library files that were built, several of which should have "filesystem" in the name. Like I said, I might have gotten the name of the file wrong.
-
At any rate there should be a directory somewhere full of Boost library files that were built, several of which should have "filesystem" in the name. Like I said, I might have gotten the name of the file wrong.
Well, i'm pretty much stuck. There is no such file as you describe (no .a file that has anything to do with boost or filesystem) in my HD, and i don't know if i really succeded in building boost or not. I'm not sure, how would i know, if i did succed. I posted a message on one of the boost mailing lists asking how do i know, if the build did succed, but no answer.
What to do next?
-
What to do next?
Although providing support for 3rd party libraries is (as previously stated) outside the purview of the C::B forums, I think a quick-start guide for Boost+C::B would not go amiss in the Wiki. In the meantime, I'll also send you a personal message as soon I've rebuilt Boost myself.
-
Helo again,
i think i succesfully built boost. Now, the next question is, how do i link it in Codeblocks to my program ?
Note:
boost build directory is C:\Documents and settings\Kane\build-boost\
I notice you use space within your directories ... when you use space remember to reference that with the 8.3 convention then it will "find" the files, else it will not find them ... I personally use D:\Sources\Boost, and D:\MingW, and D:\CodeBlocks ...
Best Regards,
-
For those interested, a BoostWindowsQuickRef (http://wiki.codeblocks.org/index.php?title=BoostWindowsQuickRef) article is now available in the Wiki.
-
For those interested, a BoostWindowsQuickRef (http://wiki.codeblocks.org/index.php?title=BoostWindowsQuickRef) article is now available in the Wiki.
Well done TDragon, nice work!
-
Ok, i relocated everything, so that there are no spaces in paths (i reinstalled Codeblocks too), and i followed the Wiki exactly as it is written. No luck, though. I was trying to compile the example program here (it requires the regex library):
http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html#link-your-program-to-a-boost-library
Message:
C:\C++\Proba_boost\main.cpp|1|boost/regex.hpp: No such file or directory|
Now, that i am looking at the bjam output, while it is a big mess, i can see a lot of g++ related "failed" messages.
By the way, g++ is in my PATH, wich looks like this:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\CodeBlocks\MinGW\bin;C:\boost_1_35_0;
I also tried removing the semicolon from the end of PATH, and then executing bjam, but that didn't help either.
-
Okay, the article is not quite right. I forgot about the "boost-1_35" subfolder in the includes directory. Will now correct it.
You can either (A) add the "boost" global variable and project search folders as per the skipped steps in the Wiki article, using "C:\CodeBlocks\include\boost-1_35" for the include field ("C:\CodeBlocks" for the base field), or (B) add "C:\CodeBlocks\include\boost-1_35" directly to your project's Compiler search directories.
Really, though, you should have been able to figure that out on your own. It's as simple as seeing that you want to include boost/regex.hpp, and seeing that the path boost/regex.hpp is in C:\CodeBlocks\include\boost-1_35.
Now, that i am looking at the bjam output, while it is a big mess, i can see a lot of g++ related "failed" messages.
This may or may not be normal. Hopefully the libraries you want are getting built.
-
Well, i first did A, and got this while compiling the project:
C:\CodeBlocks\MinGW\bin\ld.exe: cannot find -lboost_regex-mgw34-mt-1_35.lib
With option B it was the same error.
I tried googling what can cause this type of error, but no luck so far.
-
C:\CodeBlocks\MinGW\bin\ld.exe: cannot find -lboost_regex-mgw34-mt-1_35.lib
this error indicates that you entered "boost_regex-mgw34-mt-1_35.lib" into the linker options which is wrong. please enter "boost_regex-mgw34-mt-1_35" (notice the missing ".lib").
In addition: You are using the MinGW compiler, right? I wonder why you get ".lib" files when you compile Boost. Using MinGW you should have compiled ".a" files...?! Probably you are mixing MinGW compilation with some unsupported format (e.g. you compiled boost wit a compiler that is not compatible with MinGW)???
-
In addition: You are using the MinGW compiler, right? I wonder why you get ".lib" files when you compile Boost. Using MinGW you should have compiled ".a" files...?! Probably you are mixing MinGW compilation with some unsupported format (e.g. you compiled boost wit a compiler that is not compatible with MinGW)???
Nope, Boost Build causes GCC to create .lib files as of Boost 1.35.
-
Nope, Boost Build causes GCC to create .lib files as of Boost 1.35.
I just tried: Indeed! ...how weired. :shock: That surely will cause some trouble. Strange they decided to do so.
The include folder also looks pretty strange include\boost\boost-1_35??? Huh? I just moved the files directly to boost and it seems to work as well.
-
Here is my boost compilling recipe (I'm using 1.34):
- using msys
- go to boost root dir
# cd tools/jam/src
# ./build.sh
- go back to boost root dir
# tools/jam/src/bin.ntx86/bjam toolset=gcc variant=release threading=multi link=static stage
-
this error indicates that you entered "boost_regex-mgw34-mt-1_35.lib" into the linker options which is wrong. please enter "boost_regex-mgw34-mt-1_35" (notice the missing ".lib").
It is still giving the same message.
-
Ok, well it seems i finally managed to compile it !
You see, the problem was, that boost build gave wrong names to some of the library files it built.
Most of the built library files look like this:
boost_*-mgw34-mt
However, for some odd reason, the regex library file (and only that) looked like this:
libboost_regex-mgw34-mt
Once i renamed it, so there is no "lib" prefix, Codeblocks was able to compile it.