Files in sub-directories of Boost library do not load (C++) - c++

I'm using Visual Studio. I just watched a tutorial on how to use libraries with the boost library in C++, and I added C:\Program Files\Cpp_Libs\boost_1_74_0 to Include Additional Libraries property in my project.
It works with optional.hpp in the boost_1_74_0\boost directory, but it doesn't work with the files in the boost_1_74_0\boost\archive directory or other sub-directories.
VS is recommending I install vspkg to install boost-serialization, but is there a way I can do it without this?
Thanks.

Related

does adding libraries in eclipse work the same way as in visual studio?

I used to code using visual studio,when linking boost libraries I just added the folder having libraries e.g boost/lib and vs automatically choose the required lib files and link against them.
Now I am trying to link to boost lib in eclipse.I added the /usr/loca/lib folder which has boost library files.
But undefined reference error happens to all boost libraries.
I read that I must add each library file by its name in eclipse.
Is this the only way ?Is there automatic way to choose the required library files like visual studio?
thanks for your help.
I assume by Eclipse you mean Eclipse with MinGW or Cygwin (both GCC-based toolchains).
Auto-linking (#pragma comment(lib ...)) is a Visual C++ feature that is not available in GCC.
With GCC you have to specify all the boost libraries that you're using when linking the program (including any libraries used by those libraries, like -lboost_system, etc.), in the right order.

Utilizing the Boost library in a C++ project

I've imported the boost library files into my project, the issue is VS studio is not recognizing the files based on the default include directory locations.
I can go into properties->config properties->C/C++->General->add include directories ... but it is a pain to do so for so many directories.
VS Code tells me to install vcpkg ... what's the easiest means of including the dependencies without reconfiguring directory settings?
ie: Using this default location for all boost files.
#include <boost/math/special_functions/bessel.hpp>

Installing boost 1.52 with VS2012

I followed these instructions to install boost and to compile all libraries:
https://www.quantnet.com/threads/tutorial-quantlib-boost-installation-in-visual-studio-2012.11891/
Boost Installation The Boost library can be downloaded here.
Currently, the latest version available is Boost 1.52.0. You can build
boost by following the instruction here.
Alternative you can download
a pre-built lib from here. Once downloaded, copy the installer into
the Boost 1.52.0 folder and run it. Rename the folder to lib once
done.
So I downloaded boost 1.52, then copied that to C:\Program Files (x86)\boost\
I then downloaded the 1.52 64 bit installer and once downloaded, pasted that to:
C:\Program Files (x86)\boost\boost_1_52_0\boost_1_52_0\
I executed the installer- it said "extracting" and then many library names.
I then renamed the last folder to lib, so that I had:
C:\Program Files (x86)\boost\boost_1_52_0\lib\
In my VS2012 I then added the previous directory to my project. The project then starting parsing through the libraries and I had no linker errors. However, when building the project I still got:
LINK: fatal error LNK1104: cannot open file
'libboost_date_time-iw-mt-gd-1_52.lib'
(The only usage of boost in my project is file_mapping and mapped_region)
Help?
EDIT: I am aware about some libraries needing to be compiled separately in boost. I thought the above was to achieve this? If not, could someone please advise how because this really becomes a pain.
Boost has some libraries (most of them) used as source headers (.h files) that do not need to be pre-compiled, but there are also some libraries that need to be pre-compiled (.lib files). You can either download the libraries pre-compiled from the Boost website (http://www.boostpro.com/download/), although you might get some older versions from there, or compile them (the latest version or any of those available you want) on your own, although please have in mind that this might take some time, depending on your computer specs. See here for more: http://www.boost.org/doc/libs/1_54_0/libs/regex/doc/html/boost_regex/install.html.
After downloading the "normal" boost package, put the folders/files extracted on a folder and then assocciate it in VS2012 by putting the folder path in
(YourProject > Right-Click > Preferences >)General > VC++ Directories > Include Directories.
Then download and install the pre-compiled libraries (extract them on a folder) and then associate this folder with the VS, in
(YourProject > Right-Click > Preferences >) Linker > General > Additional Library Directories.
Of course, as mentioned before, you can also compile the packages you want, and then associate them with Visual Studio the same way.

including boost source files in project using eclipse

I am using boost libraries in an application which is targeted for multiple platforms including android.
unfortunately boost libraries are not included in android so i am trying to include the boost source files in project and compile them but i am getting many errors when i am trying to do that mostly unresolved symbols in many files
i have created the project as a shared library using eclipse ide and os is ubuntu 11.10
please help and i am not really a nerd so easy to understand solution would be really helpful.
Thanks in advance
make a folder called local/include/ in your home folder. Then create a symbolic link from /usr/include/boost to there. Include ~/local/include in the LOCAL_C_INCLUDES variable in your Android.mk. This will work for the header-only libraries in boost.

Build boost.Log on Windows 7

I recently downloaded http://boost-log.sourceforge.net/libs/log/doc/html/index.html but I can't seem to find out how to build it. The rest of my boost lib was installed by using the installer, so all I did was selecting the files I wanted to include.
So how do I build Logs? Building for windows is completely new to me and I would really appreciate any help!
EDIT
Merge boost.log in the boost directory structure first.
Did you build boost ? If not, you have to go to your boost directory, run boostrap.sh and then run b2.exe. That will build all boost libraries.
Since you are on Windows, boost supports automatic linking, i.e. you just include the header files and the required libraries will be linked automatically when building your project from Visual Studio.