Friends, I've looked at every conceivable link on the net to explain how to use a 3rd party library in my code. I really have spent the past 3 days trying to do this simple task and I see many newbies on the internet have the same question.
To try and guide you all, for the purposes of this exercise, let us use:
1) Code::Blocks as the IDE as its probably one you are most verse in.
2) "Boost" library as its one you are most verse in.
Using this common IDE and common library, I have done the following, all VERBATIM as per advise on the one FAQ page:
Observe carefully my precise steps:
1) I downloaded the official windows Boost.zip library (Version 1.54.0) and extracted it into the following folder on my computer: C:\boost_1_54_0
2) I opened CodeBlocks, created a new project and main cpp source file.
3) I tell the compiler where to find headers and library files: I set up global compiler path directories for the boost library by opening settings -> compiler and debugger -> tab search directories -> sub tab compiler -> add button and entering the search directory: C:\boost_1_54_0
4) I tell the linker where to find headers and library files: I set up global linker path directories for the boost library by opening settings -> compiler and debugger -> tab search directories -> sub tab compiler -> add button and entering the search directory: C:\boost_1_54_0
5) I tell the linker which libraries the programme is using: I right click my project on the left hand side pane and select build options. I click the linker tab. Under Linker Settings I press add and then I add the library I wish to use: C:\boost_1_54_0\
6) In my main source code, I add the header:
as this is the function header I wish to use. You see, its a header not a library, as Boost contains header only files and there is no need to build.Code:#include <boost\algorithm\string\find.hpp>
Anyway, after doing all this I get the error that the programme exited with status 1 and the exe couldnt even run. All I had was a main function with no contents just to check if it runs. Whats worse, after setting all these options, the programme doesnt even recognise the string variable even after including #include <string>. It says string not declared in this scope.