![]() |
| | #1 | ||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| some questions about Boost libraries i have just downloaded the latest boost source codes and compiled them, and configured the stuff as i should have! and then i tried to compile some examples to see how stuff works, and also to check if everything went well! . one of the examples ran well! but the other one which you can see below, gave me couple of errors! Code: #include<iostream>
#include<boost/filesystem/operations.hpp>
namespace bfs=boost::filesystem;
int main()
{
bfs::path p("second.cpp");
if(bfs::exists(p))
std::cout<<p.leaf()<<std::endl;
} Code: ||=== boost example, Debug ===| obj\Debug\main.o||In function `_Z41__static_initialization_and_destruction_0ii':| F:\Program Files\CodeBlocks\include\boost-1_40\boost\system\error_code.hpp|205|undefined reference to `boost::system::get_system_category()'| F:\Program Files\CodeBlocks\include\boost-1_40\boost\system\error_code.hpp|206|undefined reference to `boost::system::get_generic_category()'| F:\Program Files\CodeBlocks\include\boost-1_40\boost\system\error_code.hpp|211|undefined reference to `boost::system::get_generic_category()'| F:\Program Files\CodeBlocks\include\boost-1_40\boost\system\error_code.hpp|212|undefined reference to `boost::system::get_generic_category()'| F:\Program Files\CodeBlocks\include\boost-1_40\boost\system\error_code.hpp|213|undefined reference to `boost::system::get_system_category()'| obj\Debug\main.o||In function `_ZThn48_NK5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10filesystem22basic_filesystem_errorINS3_10basic_pathISsNS3_11path_traitsEEEEEEEE7rethrowEv':| )]+0x80)||undefined reference to `boost::filesystem::detail::status_api(std::string const&, boost::system::error_code&)'| F:\Program Files\CodeBlocks\include\boost-1_40\boost\throw_exception.hpp:(.text$_ZN5boost6system10error_codeC1Ev[boost::system::error_code::error_code()]+0x14)||undefined reference to `boost::system::get_system_category()'| ||=== Build finished: 7 errors, 0 warnings ===| i think the above errors are due to the absence of a lib file of some kind! so please help me on this ! and the second question is how can i find more about classes, functions and other useful stuff in boost , just like what we have in C++ Reference [C++ Reference] with examples for each of them , so that i can understand how to use them in my program . thank you all in advance
__________________ Highlight Your Codes Quote:
Quote:
Last edited by Masterx; 11-07-2009 at 09:20 AM. | ||
| Masterx is offline | |
| | #2 |
| (?<!re)tired Join Date: May 2006 Location: Portugal
Posts: 5,220
| Only a very limited selection of boost libraries need compiled libs. Filesystem is one of them. The others are (if I'm not missing anything...) Date Time Graph Iostreams Math Program Options Regex Serialization Signals System Test Threads Wave You know which ones need compiled libs by either looking at the library documentation, looking at your boost lib folder, or looking at error messages like you had. Simple. As for help with Boost libraries: - Documentation is often very good and that is all you need. - There's also plenty of material on the web if you search for help on a particular library. - There's this forum that can hopefully answer your questions on any issue you may have. - And there's this one book which provides some introductory material into a representative (and often used) group of boost libraries: Addison Wesley - Beyond the C++ Standard Library, An Introduction to Boost, by By Björn Karlsson
__________________ Originally Posted by brewbuck: Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster. |
| Mario F. is online now | |
| | #3 | ||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| tanx . i'll give it a try, if ran into any problem i post here again . again thank you verymuch
__________________ Highlight Your Codes Quote:
Quote:
| ||
| Masterx is offline | |
| | #4 | |||||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| damn it! im trying to rebuild the binaries from the source codes. first i tried Quote:
but i couldnt get everything to work . now im trying to rebuild the binary using Quote:
it says "its not found! " what the ...!? now what ? where should i dig in? can any one give me a step by step procedure to compile/build the whole stuff from source code ? for visual Studio 2008 and CodeBlocks in windows, so that everything would be there ready to use? i would be very thankful . ---------------------- im trying to build the source codes using the -a postfix (suffix !?) for .\bjam, i mean Quote:
thanx in advance
__________________ Highlight Your Codes Quote:
Quote:
Last edited by Masterx; 11-07-2009 at 10:17 PM. | |||||
| Masterx is offline | |
| | #5 | |||||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| well ,i deleted the boost directory , and tried to start form begining! so i uncompressed the source codes under a folder as "boost_1_40_0" in my root of drive F as : Quote:
Quote:
--------------------------------- for my CodeBlocks and hence gcc compiler i used Quote:
can anyone tell me what i did mess up! ?and tell me how can i get both my visual studio and codeblocks to work. let me clarify it more . i have both Visual Studio 2008 and CodeBlocks installed on my system. and im planning to work on both specially to make sure my projects compile fine on both of them . so i think i have to simply compile the Boost libraries twice ! one time for visual Studio and the second time for my gcc compiler ( codeblocks). it seems whenever i try to compile one after another!, one of them stop functioning ( that might be because of wrong procedure i chose to compile?!) i have a folder named boost_1_40_0 which has the uncompressed boost libraries in it . is there any way that i only build the libraries once and then both CodeBlocks and Visual Studio 2008 can make use of it ? is there any way to do that ? i noticed after first build the boost library folder ( here on my system ) becomes 1.7 Gigabyte ! and when i tried to build it the second time for my gcc , it exceeded 2.4 Gigabyte! and since i have little space left on my H.D.D i canceled it and im looking for a help here.. so to cut a long story short. how can i build my boost completely ( i mean with the whole stuff built) for both my visual studio 2008 and codeblocks ? tanx and sorry for bothering ya .
__________________ Highlight Your Codes Quote:
Quote:
Last edited by Masterx; 11-08-2009 at 03:52 AM. | |||||
| Masterx is offline | |
| | #6 |
| (?<!re)tired Join Date: May 2006 Location: Portugal
Posts: 5,220
| I know, I know. First time I tried out boost I also had trouble with their builder. Boost.Build is not the knight in shiny armor coming to save us from the teeth of the Make Dragon. They sent us a peasant with a pitchfork. So, Boost.Build becomes just another builder that forces people into learning yet another syntax, which really doesn't add any benefit whatsoever to what we already have, neither it simplified what we already have. It's the "I can do better than you" syndrome that never translates into "better" but always to "more of the same". It has also affected others. Regular Expressions Hell is that place where all regular expressions extension makers and new syntax developers go when they die. Enough rant... .... You can, if the whole thing is starting to get in your nerves, simply download the binaries already compiled for you: Boost C++ Libraries Installers for Windows - BoostPro Computing. But only if you are using MSVC 2008 or 2005. If you are using gcc you have to go through building boost yourself. what you are after is the following command line: Code: bjam --prefix=c:\dev\boost toolset=gcc debug link=static threading=multi runtime-link=static --without-python install - You want the built libraries to go into a lib folder inside c:\dev\boost - You want to build the libraries with threads support - You want the libraries to be compiled against the static runtime - You do not want the python library - And you are instructing boost.build to install everything (including documentation) Now, on your case: - I suppose you want to change the toolset to gcc. - You don't need the runtime-link=static with gcc, if memory serves me right. I think with the gcc toolset, runtime-link will be ignored altogether. I'm keeping it there for the sake of it. - Once this build is done, you will want to then repeat this command changing "debug" to "release" in order to build the release version of the libraries. - Once those two are done, you may want to create the dll versions of the libraries. If you indeed wish to create those, you need to repeat the command for the "debug" and "release" versions of the libs, but this time changing "link=static" to "link=shared". - You don't need bootstrap! - You simply download the libraries from here as well as boot jam. Decompress the whole thing to some folder in your disk and move the bjam executable inside too.
__________________ Originally Posted by brewbuck: Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster. |
| Mario F. is online now | |
| | #7 | |||||||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| many thanks dear Mario F. before i see your post and go through the instruction you gave me , i have prepared some thing to post here, its a summery of what i did and what i got . here it is . before that i must say that i do not have the ability to use that boostpro stuff , cause i dont have a broad band internet connection , so thats a pain in the neck . and also i would want to have it ready for offline systems, so thats why im trying to compile and build the boost form its source codes. and oh, by the way i have already downloaded the boost_1_40_0.7zfrom the link you just provided me and all i did was with this package. ok here is the summery of what i did and its result . i rebuild my boost source code for Visual Studio 2008 using the : Quote:
then it seemed everything went just fine . tried to compile some boost examples . some of them compiled and some didnt . i noticed that whenever i tried to used regex for example, i got an error indicating :" Quote:
found regex folder, there were bunch of other subfolders , starting with build, and then msvc-9.0 and finally debug. so simply i went to : Quote:
i righ clicked on my project and chose properties, then i navigated to the linker Option . and went for the "Additional Library Directories " then typed " Quote:
again the same error message poped up! . i changed the path in linker section to " Quote:
and Applied the changes, and went for compiling the example . Yeah , it compiled just fine . the problem is i have this kind of problem with most of headers ( i mean those which need to be compiled like system and etc') . i just cant go do this kinda of stuff for each time im going to use a specific header file . the problem gets worse when i try to use multiple header files! what should i do to solve my problem ? ---------------------------- and my second problem is that i have codeblocks IDE and gcc installed on my system ,putting, having the same above problem, aside, i need to code in both IDEs (VS 2008 and C::B), so i need both of them to function well when using boost libraries, i noticed that i should build boost libraries twice , once for each of them ,and again i found out that i need two separate folders for this . am i right so far? and if not how can i build the boost library and configure both of the IDEs to use the built boost libraries . Thank you in advance .
__________________ Highlight Your Codes Quote:
Quote:
Last edited by Masterx; 11-08-2009 at 11:00 AM. | |||||||
| Masterx is offline | |
| | #8 | |||||||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| and by the way im following your instruction to build my gcc version of boost . so far i built the debug versio, now im building the release version , and then i'll say what happened . ------------- Quote:
Quote:
and by the way i went to c:dev\boost , and there were two sub folders , one was include , and the other was lib. the lib folder is empty! and the include folder contains lots of headers . is it ok ? should it be like this ? ------------------------------- after all of those instructions , i followed these: Quote:
Code: #include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace boost::lambda;
int main()
{
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
what did i miss ? Quote:
Quote:
__________________ Highlight Your Codes Quote:
Quote:
Last edited by Masterx; 11-08-2009 at 11:57 AM. | |||||||
| Masterx is offline | |
| | #9 |
| (?<!re)tired Join Date: May 2006 Location: Portugal
Posts: 5,220
| Just please delete everything boost related from your hard drive and try from the very beginning following my instructions and what you get from here. Just follow the instructions. My post pertains only to the last part where you are required to build the libraries (point 5.3.4) From your output it was trying to rebuild already existing libraries. Just start from the very beginning.
__________________ Originally Posted by brewbuck: Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster. |
| Mario F. is online now | |
| | #10 | |||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| Quote:
because i think it now contains the build library ? again because when i decompressed it ( it was 30 Mb in 7zip . ) it was only 195 Mb, and then after building ,it increased to 1.7 Gigabyte . right? ( this is for my Visual Studio 2008 , using bootstrap and .\bjam -a . ) am i right so far ? do i need to delete anything else rather than this folder ? and by the way last time i just did what ever i found from the part 5.2 ! i only change .\bjam to .\bjam-a ! anyways im going to delete everything! ---------- by the way for codeblocks procedure , i looked at the folder in C:\dev, it only contains 43 Mbs!! i think thats why it didnt work! anyway im going to delete these two folders . and start form begining! ( i dont know what else to delete ! though )
__________________ Highlight Your Codes Quote:
Quote:
Last edited by Masterx; 11-08-2009 at 12:14 PM. | |||
| Masterx is offline | |
| | #11 |
| (?<!re)tired Join Date: May 2006 Location: Portugal
Posts: 5,220
| Everything
__________________ Originally Posted by brewbuck: Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster. |
| Mario F. is online now | |
| | #12 | |||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| i did what you told me to . i deleted the boost root directory and followed the instruction on boost website . decompressed the boost source codes , and before doing anything , i used .\bjam --clean nothing happened! and then started the instructions as told . after that , tried to compile a sample program form that page . i mean Code: #include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
Code: #include<iostream>
#include<boost/filesystem/operations.hpp>
namespace bfs=boost::filesystem;
int main()
{
bfs::path p("second.cpp");
if(bfs::exists(p))
std::cout<<p.leaf()<<std::endl;
system("pause");
}
Quote:
now with this , this is the 5th time i delete and then rebuild that damn boost from scratch ! i havent compile boost for my gcc compiler yet , i'll do it whenever i can get VS2008 to work .
__________________ Highlight Your Codes Quote:
Quote:
Last edited by Masterx; 11-08-2009 at 12:56 PM. | |||
| Masterx is offline | |
| | #13 |
| (?<!re)tired Join Date: May 2006 Location: Portugal
Posts: 5,220
| All is fine. You just need to link your executable against the library libboost_filesystem-vc90-mt-gd-1_40.lib. Somehow you aren't doing that right. First check if the library indeed exists. It should. So next make sure you are giving the linker the full path to the library, or adding the path to boost libraries to your linker searchable paths. This all you do from your IDE. I removed CodeBlocks from my system a long time ago. I can't remember anymore the details. Others will help.
__________________ Originally Posted by brewbuck: Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster. |
| Mario F. is online now | |
| | #14 |
| Registered User Join Date: Nov 2009
Posts: 2
| MisterX, I wanted to clarify some details. First, sorry about the broken link. I have now fixed that for upcoming 1.41. Note that you can always get up-to-date Boost.Build documentation at Boost.Build V2. Also, if you are using Windows, and Visual Studio, you should not need neither "bjam clean", neither "bjam -a". Just "bootstrap.bat" followed by "bjam". This puts the libraries to stage/lib -- in fact, the first thing "bjam" prints is a message telling where the libraries will be placed. If you run into problems, please reported them to boost-build@lists.boost.org or meet us in the #boost channel on freenode. You last error appears to be due not adding the lib directory to the linker search path. I am sure CodeBlock experts can help you with that. |
| vladimir_prus is offline | |
| | #15 | |||
| C\C++ beginner Join Date: Nov 2007 Location: Somewhere nearby,Who Cares?
Posts: 375
| Quote:
well my problem with visual studio is that , i should manually specify the libs location needed by the linker ( in linker option , the additional directories ") for everything projects that i would want to use boost! you know its really tedious to do such a thing! again and again!, i wonder if its normal when using visual studio and boost together !? i'll be definitely there if i couldn't manage to get rid of this problem . and for CodeBlock i will get that to work. but dont you thing providing the user with an Iso version of compiled binaries for boost would help alot ? i mean just make an installer that would configure the needed stuff itself and saves us the trouble , im talking about Iso, because there are some people out there that dont have access to broadband internet connection ,including me, and or needs the boost for offline systems, so in these cases that Iso would be great . i would really want you guys to do us this favor . again thanks for everything .
__________________ Highlight Your Codes Quote:
Quote:
| |||
| Masterx is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| boost libraries | herWter | C++ Programming | 6 | 07-15-2008 05:35 PM |
| Why does boost jam build repeating libraries? | indigo0086 | Tech Board | 0 | 05-30-2007 06:35 AM |
| building boost libraries | l2u | C++ Programming | 3 | 05-09-2007 08:34 AM |
| instaling boost libraries | whackaxe | C++ Programming | 2 | 06-04-2004 09:33 AM |
| Two questions (Linking Libraries and Creating Them) | Thantos | Linux Programming | 3 | 03-21-2004 05:01 PM |