How can I build a program using c++ driver of mongodb? - c++

Please tell me how to build a program using c++ driver of mongodb.
No flames about my bad English.
My Environment
Windows7 64bit
Visual Studio Ultimate 2012 (x64 Release target project)
I performed the following steps.
I installed Ptython 2.7.2, Python for Windows extensions and Scons 2.3.0.
I installed boost 1.54.0. I perfomed 'boostrap' and 'b2 -a --build-type=complete --address-model=64 --link=static --runtime-link=static'
I download mongodb-linux-x86_64-v2.4-latest.tgz.
I added the following texts to SConstruct.
env.Append(CPPPATH=['C:\\boost\\boost_1_54_0'])
env.Append(LIBPATH=['C:\\boost\\boost_1_54_0\\stage\\lib'])
env.Append(CPPDEFINES=["_UNICODE"])
env.Append(CPPDEFINES=["UNICODE"])
I performed 'scons mongoclient'.
I made a project of Visual Studio C++.
I set 'Release' and 'x64' in the project.
In Property pages/Configuration Properties/C C++/General/Additional Include Directories, I set 'C:\boost\boost_1_54_0' and 'C:\mongo\mongo-cxx-driver-v2.4\src'.
In Property pages/Configuration Properties/Linker/General/Additional Library Directories,
I set 'C:\boost\boost_1_54_0\stage\lib' and 'C:\mongo\mongo-cxx-driver-v2.4'.
In Property pages/Configuration Properties/Linker/Input/Additional Dependences, I set 'mongoclient.lib','ws2_32.lib' and 'psapi.lib'.
In Property pages/Configuration Properties/Linker/Input/Ignore Specific Default Libraries, I set 'msvcprt.lib' and 'LIBCMT.lib'.
In Property pages/Configuration Properties/C C++/Preprosessor/Preprocessor Definitions, I set '_CRT_SECURE_NO_WARNINGS'.
In Property pages/Configuration Properties/C C++/Code Generation/Runtime Library, I set 'Multi-threaded (/MT)'.
I made a program using the driver. However, the build solution of the program has failed.
1>mongoclient.lib(stringutils.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>mongoclient.lib(initializer_dependency_graph.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>mongoclient.lib(initializer.obj) : error LNK2001: unresolved external symbol __security_check_cookie
....
fatal error LNK1120: 154 unresolved externals
If would help me if you pointed out anything strange about the steps.
Thank you.

How to build MongoDB C++ driver
This solution succeeded on a machine with the following characteristics:
Windows XP SP3 32-bit
Visual Studio Express 2010 (VC 10)
I used D:\MongoDBcplusplusClient as a working directory (I installed there all the prerequisites).
Process:
Step 1
Download MongoDB C++ driver:
https://github.com/mongodb/mongo-cxx-driver
You can make a clone using Git or download it as a .zip file (I did the second).You will get a file like mongo-cxx-driver-legacy.zip. Extract it to the folder mongo-cxx-driver-legacy inside your working directory.
Step 2
Download Boost prebuilt windows binaries. ATTENTION!!! You should use a specific version of Boost. In my case version 1.52 did the trick. You can download it from here:
http://boost.teeks99.com/
I downloaded the boost_1_52_0-vc32-bin.exe self-extracting exe. Put it on your working directory and run it. It will create a folder (something like lib32) that will contain the boost binaries (.lib and .dll files)
Step 3
Download Boost source code (.h files). Of course these should be from the same version as in Step 2. I downloaded them from here:
http://sourceforge.net/projects/boost/files/boost/1.52.0/
You will get a file boost_1_52_0.zip which you can extract at boost_1_52_0 folder.
Step 4
Download Python. In this example I downloaded version 2.7.9 and specifically the Windows x86 MSI installer from here:
https://www.python.org/downloads/release/python-279/
Step 5
Download Scons from here:
http://www.scons.org/download.php
I downloaded the Windows installer (scons-2.3.4-setup.exe) and installed Scons at the Python directory (in my case C:\Python27).
Step 6
Download msinttypes from here:
https://code.google.com/p/msinttypes/
(You should include these header files to the project that uses the driver)
Step 7
Go to Start->Run… and in the Run box write cmd. In the opened command prompt window navigate to the folder at which you extracted mongo driver at Step 1. In my case I did:
cd D:\ D:\MongoDBcplusplusClient\mongo-cxx-driver-legacy\mongo-cxx-driver-legacy
Step 8
Build the driver using Scons. In the directory you navigated at Step 7 write:
scons
--prefix=D:\MongoDBcplusplusClient\mongo-cxx-driver-legacy\mongo-cxx-driver-legacy
--cpppath=D:\MongoDBcplusplusClient\boost_1_52_0\boost_1_52_0
--libpath= D:\MongoDBcplusplusClient\lib32
--win-version-min=xpsp3 install
and hit Enter.
The --prefix flag specifies the target directory at which the .lib file of the driver will be created, --cpppath specifies the folder at which the Boost header files are located and the --libpath the path to Boost .lib files. Of course you should change the path to yours. A file named libmongoclient-s.lib will be created at the --prefix/lib path.
If you want to build the driver with debugging enabled you should use the following command:
scons
--prefix=D:\MongoDBcplusplusClient\mongo-cxx-driver-legacy\mongo-cxx-driver-legacy
--cpppath=D:\MongoDBcplusplusClient\boost_1_52_0\boost_1_52_0
--libpath= D:\MongoDBcplusplusClient\lib32
--win-version-min=xpsp3
--dbg=on install
A file named libmongoclient-sgd.lib will be created at the --prefix/lib path.
Step 9
At Windows Explorer navigate to the folder at which MongoDB C++ driver is installed, go into the subfolder lib (in my case this was D:\MongoDBcplusplusClient\mongo-cxx-driver-legacy\mongo-cxx-driver-legacy\lib) and rename the file libmongoclient-s.lib to mongoclient.lib and the libmongoclient-sgd.lib to mongoclient-gd.lib.
Step 10
Open Visual Studio 2010 Express and open the project at which you want to use the MongoDB C++ driver. You should specify the dependencies. Right click on project’s name at solution explorer (left column) and hit Properties.
Go to C/C++ → General and at Additional Include Directories add:
a) Boost header files directory (in my case D:\MongoDBcplusplusClient\boost_1_52_0\boost_1_52_0)
b) MongoDB C++ driver header files directory (in my case
D:\MongoDBcplusplusClient\mongo-cxx-driver-legacy\mongo-cxx-driver
legacy\include)
c) Cstdint types header files directory (in my case
:\MongoDBcplusplusClient\msinttypes-r26 )
Step 11
Go to Linker → General and at Additional Library Directories add:
a) Boost .lib files directory (in my case D:\MongoDBcplusplusClient\lib32)
b) MongoDB C++ driver .lib files directory (in my case D:\MongoDBcplusplusClient\mongo-cxx-driver-legacy\mongo-cxx-driver-legacy\lib)
After these steps the project that uses the driver will be successfully built both in release and debug configurations.

Simple solution use vcpkg.
Download vcpkg follow the instructions as mentioned on git.
https://github.com/Microsoft/vcpkg
Step 1
C:\vcpkg>.\vcpkg search mongodb
you will see something like this
mongo-c-driver 1.6.2-1 Client library written in C for MongoDB.
mongo-cxx-driver 3.1.1-1 MongoDB C++ Driver.
Step 2
C:\.\vcpkg search mongodb install mongo-cxx-driver
then grab cup of coffee ....
Step 3
C:\vcpkg>.\vcpkg integrate install
Done..
Note
Prerequisites:
Windows 10, 8.1, or 7
Visual Studio 2017 or Visual Studio 2015 Update 3
simply import
#include <cstdint>
#include <iostream>
#include <vector>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/stdx.hpp>
#include <mongocxx/uri.hpp>
using bsoncxx::builder::stream::close_array;
using bsoncxx::builder::stream::close_document;
using bsoncxx::builder::stream::document;
using bsoncxx::builder::stream::finalize;
using bsoncxx::builder::stream::open_array;
using bsoncxx::builder::stream::open_document;

Related

How to use jsoncpp with Visual Studio 2022

I need my project to be able to use json format.
I was suggested this github : https://github.com/open-source-parsers/jsoncpp
I have been trying to integrate it to my project for multiple hours and still cant find the issue.
I still get these errors on my include :
#include <jsoncpp/json/json.h>
E1696 cannot open source file "jsoncpp/json/json.h"
C1083 Cannot open include file: 'jsoncpp/json/json.h'
I tried to go to C/C++ General->Additional Include Directories>
to add the "jsoncpp-master\include" directory
also tried "jsoncpp-master\include\json" directory
also tried to add the .h and .cpp found in the repository directly.
I have also tried a multitude of other things but I'm not sure it would be relevant to list them all here.
I was not able to find instructions to use it with Visual Studio 2022 on their github either.
Safest and most convenient way to use third party libraries is to use package manager like vcpkg
https://vcpkg.io/en/index.html
https://github.com/microsoft/vcpkg
Choose what build you want x86 or x64 and set default triplet in your environment variables
VCPKG_DEFAULT_TRIPLET
x64-windows - DLL Build 64-bit windows
x86-windows - DLL Build 32-bit windows
x64-windows-static - Static Build 64-bit windows
x86-windows-static - Static Build 32-bit windows
If you have added jsoncpp-master\include to C/C++ General->Additional Include Directories then you should use #include <json/json.h> instead of #include <jsoncpp/json/json.h>
Explanation : The compiler is looking inside the include directory. If you observer the file structure you can see json folder is located in the include directory and not jsoncpp.

cannot see the file 'SDL2.lib'

This question is not a duplicate of cannot open file 'SDL2.lib' which discusses this same error but my problem is that I don't have an SDL2.lib file, if I can just see it I can make this work
I'm trying to set up the development environment for SDL2 by following Lazy Foo's tutorial.
Setting up SDL 2 on Visual Studio 2010 Ultimate
The tutorial is for Visual Studio 2010, I'm using Visual Studio Community Edition 2017. Is that a problem?
The problem starts when linking the libraries, there is no x86 or x64 folder inside the lib directory of SDL2's Windows Development libraries that I downloaded from SDL version 2.0.8 (stable).
So I specified it as lib/ instead of lib/x86 as it says in the tutorial.
These are the files inside the lib folder
$ ls
cmake/ libSDL2.dll.a libSDL2_test.a libSDL2main.a pkgconfig/
libSDL2.a libSDL2.la libSDL2_test.la libSDL2main.la
When building VS2017 is throwing an error saying that Cannot open file 'SDL2.lib'. Yeah, there is no such file. Do I need to do an additional step to get this file?
When I configured for CodeBlocks it works fine. What exactly am I doing wrong here? This may have an obvious answer but I'm not able to find it.
Library name `libSDL2.dll.a' indicates that it is not meant for use with VS C++ ( for dynamic link you need dll + lib, for static link you need only the lib ). You can construct a lib file from dll using dumpbin.exe and lib.exe. Your options are:
1) Download SDL source file in zip format from GitHub and create you own binaries.
2) Use vcpkg and install in just one command line ( recommended).
3) Download the SDL binaries from internet. ( you can have linker issues if the project configurations doesn't matches yours)

Point Cloud Library with Visual Studio 2017

I'm having trouble using Point Cloud Library with Microsoft Visual Studio 2017.
I have installed [PCL-1.8.1-AllInOne-msvc2017-win64.exe] and I've followed the steps mentioned
here. to link it to my Visual Studio 2017 project.
My problem is that Visual Studio is not finding the header nor the source files of the library I need.
The error I'm getting is as follows:
[fatal error C1083: Cannot open include file: 'pcl/io/pcd_io.h': No such file or directory]
To be more precise about my problem, I need to include three PCL header files in order to run thisIterative Closest Point Tutorial
I've followed the following steps to include the PCL into my project:
Added the include directories to my project at the Project Properties/Configuration Properties/VC++ Directories/Include Directories field - here I specified the path to my PCL/include directory and to all 3rd party include directories (PCL/3rdParty)
Added the library directories on the same settings page (Library Directories field) - hereI specified the path to my PCL/lib directory and to all non-header-only 3rd party libs (Boost, Flann, VTK)
Chose the libs to be used in the linker. In Project Properties/Configuration Properties/Linker/Input/Additional Dependencies field. I added all the libs required. As I'm trying to run it in debug mode for now, I've picked the "_debug.lib" library files.
Finally, I've added the PCL/bin folder to my system path variable.
Does anyone know if I'm missing something configuration-wise?
I've seen several old posts about incompatibility between older Point Cloud Libraries and older versions of Visual Studio. As far as I understood, the new versions are supposed to work well together, but it's not the case for me.
Installing pcl is tough because there are dozens of dependencies used along with pcl software. But with with vcpkg,a command line package manager, the installation becomes just like a one liner command.
Use Microsoft vcpkg to build a static or dynamic library for your project automatically. All the dependencies like boost,tiff,openssl,flann,szip,etc will be downloaded and installed by itself. After installing vcpkg type the following on Powershell.
.\vcpkg install pcl:x64-windows-static
The link you referenced is 3-4 years old. At the time, any binary build of PCL for Visual Studio 2012 or later was not provided, and thus. PCL needed to be built with target VS. And every include/library directory of PCL and any related library have to be manually added to setup the IDE. Since PCL is a large-scale collection of libraries, this made it difficult for its users to setup VS.
Now early 2018, binary builds of PCL for VS 2015/2017 and more automatic way to setup VS (e.g., adding library/include directories) using CMake are provided. Thus, installing PCL and creating a VS project using PCL does not take more than 10 minutes. I think you'd better follow the recommended way rather than setting VS by yourself.
the previous answer use vcpkg is good,but is better to use:
.\vcpkg install pcl:x64-windows
It can let you have fewer problems.
A small note for anyone who has issues with the install listed above, occasionally an install will get corrupted and not work. I got:
LINK : fatal error LNK1201
on a build, and the solution for that is find the downloaded item. This will be located in the vcpkg/downloads/ directory. Delete the item that was having issues and try the install again.

Getting LibCurl to work with Visual Studio 2013

I am having trouble getting LibCurl to work with Visual Studio 2013. I downloaded the current version (curl-7.33.0) and tried following the instructions I found on this site: Using LibCurl with Visual 2010
But I can't find curllib.lib in the folder I downloaded. And I am still getting errors:
After searching the internet for more help. I now get these error messages. There appears to be a problem with linking to libcurl.lib?
This is what I have configured:
Inside /lib I have libcurl.lib and libcurl.dll
UPDATE
I downloaded this release for Win32 MSVC: http://curl.haxx.se/download.html#Win32
After adding the libcurl libraries and successfully compiling, I am now getting this error message:
The application was unable to start correctly (0xc000007b). Click OK to close the application.
Here is the sample code I am trying to run:
#include <iostream>
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
FINAL UPDATE
I believe I have gotten LibCurl to work with Visual Studio 2013 now. Persistence ftw!
Although, after spending hours trying to solve these error messages, I am a little hesitant at saying everything is working fine now. That is why I am putting a bounty on this question to get clear and concise instructions on getting LibCurl to work with Visual Studio 2013.
This is what I did to get it to work:
First, download the Win32 MSVC package here: http://curl.haxx.se/download.html#Win32
For these instructions sake, let's say you downloaded to C:\LibCurl
Start a new project in Visual Studio. Go to Project|Project Properties|VC++ Directories|Include Directories|
Add the path to the include directory inside the downloaded package. (C:\LibCurl\include)
Next, go to Project|Project Properties|Linker|General|Additional Library Directories|
Add the path to the lib directory. (Where curllib.dll is located)
Then, go to Project|Project Properties|Linker|Input|Additional Dependencies|
And add curllib.lib
Now if you compile a test program, you will likely get the message saying libsasl.dll is missing. You will need to download this file and put it in the same directory as your build.
I used 7-Zip to extract libsasl.dll from OpenLDAP for Windows. OpenLDAP for Windows
This is the result of my test code from above:
A lot of these instructions are out of date because they recommend the win32-ssl-devel-msvc package for curl, which no longer exists.
The following instructions allow you to build libcurl using only:
Visual Studio 2013
curl generic source tarball (tested on curl 7.44.0).
A. Build libcurl static library
Download the latest curl generic source from: http://curl.haxx.se/latest.cgi?curl=tar.gz
Extract the source to a local directory (we'll be using C:\libcurl)
Open a command prompt
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat" To initialize your VC environment variables (adjust your VS 2013 installation directory as needed)
cd C:\libcurl\winbuild
nmake /f Makefile.vc mode=static VC=12
The build should appear in C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl
B. Link Against libcurl in Visual Studio
In Visual Studio, right click your project in Solution Explorer, then click "Properties"
Configuration Properties > C/C++ > General > Additional Include Directories: add C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\include
Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions: add CURL_STATICLIB
Configuration Properties > Linker > General > Additional Library Directories: add C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib
Configuration Properties > Linker > Input > Additional Dependencies: add libcurl_a.lib
C. Call libcurl from Your Project
The following sample shows a call to libcurl:
#include "stdafx.h"
#include <curl/curl.h>
void main(int argc, char* argv[])
{
CURL *curl = curl_easy_init();
if (curl) printf("curl_easy_init() succeeded!\n");
else fprintf(stderr, "Error calling curl_easy_init().\n");
}
I would say that in a comment, but I am lacking in points.
You don't have to copy any .dll into your program run catalog.
Go to Project | Properties | Configuration Properties and in line Envrionment write: PATH=$(ExecutablePath)$(LocalDebuggerEnvironment).
From now on, all .dlls from any catalog you mention in Project|Project Properties|VC++ Directories|Binary should be usable without copying them.
The rest is exactly as you written.
The easiest way to do this that I found is first make sure that nuget is installed.
http://www.nuget.org/
Then create your project.
Then go to http://www.nuget.org/packages/curl/ and follow the instructions which is to go the package manager console and type PM> Install-Package curl
If you then look for the packages directory in your project directory, you will find the include files and the library files. Note that there is a version for Visual Studio 110, not 120, but because libcurl is a C library you can use it with Visual Studio 2013. Make sure the include directory and lib directory are specified under the Visual C++ directories in project properties.
Make sure you have the following files as addition input to the linker
libcurl.lib;libeay32.lib;ssleay32.lib;Ws2_32.lib;libssh2.lib;zlib.lib;wldap32.lib;
Another way to use curl/libcurl is build with CMake v2.8.12+ (assuming that git is already installed on your computer)
Open cmd window and change dir to appropriate folder
git clone https://github.com/bagder/curl.git
mkdir msbuild
cd msbuild
cmake ..\curl -G"Visual Studio 12 Win64" -DCMAKE_INSTALL_PREFIX=C:\curl.vc12 -DCURL_STATICLIB=ON
< ... lots of output here ... >
Open generated CURL.sln in Visual studio and build it.
CMake options I use in example
-G selects build generator. In our case Visual Studio 2013 64 bit target
-DCMAKE_INSTALL_PREFIX - provides root folder where targets should be installed
-DCURL_STATICLIB=ON - generates build for static library
After building install target, your will find bin/include/lib folders in C:\curl.vc12
Provide those path to your solution and build your code with curl lib.
I tried to do it from scratch with VS2012 (I don't have 2013) and it works perfectly.
I downloaded version 7.19.3 from http://curl.haxx.se/latest.cgi?curl=win32-ssl-devel-msvc because it's the only available version for VS.
I added the include directory, not the curl directory as he says in the tutorial.
I compiled a small toy project without any problem.
So, I'm not sure what your problem is, but:
Make sure you download the right archive.
Try to put the cURL folder on a path without space.
If you know someone who use VS2012 or older, try your code with the same include and lib and see if it works.
Paste a minimal working example of your code so I can test it.
This is a bit late, but for those who still have problems, this method worked best for me:
Add VS to the system PATH:
For example: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin.
Download current curl-X.zip from http://curl.haxx.se/download.html and unzip.
Open command line at curl-X/winbuild.
Call vcvars32.bat.
Call nmake /f Makefile.vc mode=static VC=12.
Goto curl-X/builds/libcurl-XXX.
There you find the includes and a libcurl_a.lib.
This lib works fine for me.
Remember to define -DCURL_STATICLIB when you compile your code with this lib.
For Visual Studio 2017, the steps in link worked for me. In case the link expires or specifically for those who download the libcurl zip file instead of cloning from GitHub, I will note down the steps here.
Set environment variables with “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat” x64. If the command is successful, you will see a message that says Environment initialized for 'x64'
Download and extract the compressed libcurl file from download libcurl. I used the .zip file.
cd into winbuild directory inside the extracted libcurl folder.
Run nmake /f Makefile.vc mode=dll MACHINE=x64 to build. For more information on build options, please refer to BUILD.WINDOWS text file in winbuild folder.
Go up one directory level and cd into builds folder to find the compiled files.
All the best!
The problem is that the targets for the default VS2013 platform tools are not set in the NuGet packages. This is why it works in VS2012 but not VS2013. I manually created replacement targets files. Instructions and download:
https://github.com/evoskuil/curl-nuget-targets
Download the curl v7.37.0 source code and use the Visual Studio project files provided.
I've spent the last few weeks polishing my own personal project files, that were based off the original VC6 files, and adding them to the repository.
.dsw / .dsp (VC6), .sln / .vcproj (VC7, VC7.1, VC8 and VC9 as well as .sln / .vcxproj (VC10, VC11 and VC12) files are provided for both DLL and Static Library builds with support for OpenSSL and Windows SSPI / SChannel in both Win32 and x64 configurations.
I found an easy way to get it work in VC++ using the latest package. I basically followed the steps in Using libcurl in Visual Studio. The libcurl and VC++ are very old in the instruction.
First download the ZIP file on download page https://curl.haxx.se/download.html The ZIP package is https://curl.haxx.se/download/curl-7.50.1.zip
Go to projects-> Windows\VC10 (or your version of VC)\lib\libcurl.sln, open the project in VC++.
Build the project in DLL Release. DLL debug doesn't work on my VC++.
Go to build\Win32\VC10\DLL Release, you can find the lib and dll files generated from previous step.
Create a folder new, with include and lib folders. Copy the libcurb.dll and libcurb.lib whatever is in the DLL Release folder to the new\lib. Copy everything in curl-7.50.1\include to new\include folder.
C++ Properties -> Configuration Properties -> VC++ Directories, add new\include to Include Directories, new\lib to Library Directories; add new\lib to Linker -> General -> Additional Library Directories, add libcurl.lib to Linker -> Input -> Additional Dependencies
It seems that I have to put the dll file under the same folder with executable file.
It should work.

How to include boost::thread in your C++ project?

What do I need to do to include boost::thread in my project? I have copied the whole thread folder to my working path (I wish to be able to run this on several computers) and I get
fatal error C1083: Cannot open include
file:
'boost/thread/detail/platform.hpp': No
such file or directory
From the line #include "thread/thread.hpp"
What gives?
edit:
Even if I just link to the boost folder where the precompiled binary installed and I use #include <boost/thread/thread.hpp> I get
fatal error LNK1104: cannot open file
'libboost_thread-vc90-mt-1_41.lib'
Unfortunately boost::thread is not a "header-only" library -- hence you need to have it compiled. There are basically two ways to go around it.
you download a prebuilt install package from boostpro (assuming that you are on windows) -- https://sourceforge.net/projects/boost/files/boost-binaries/
you can build it yourself - see http://www.boost.org/doc/libs/1_35_0/more/getting_started/index.html
Once you have downloaded, unzipped and installed the boost libraries in your Visual Studio environment, and told the Visual Studio project where the Boost libraries live, you are not quite finished yet. There exist a number of libraries in Boost libraries that require that you build them yourself. Boost threads is one such library.
Build the bjam.exe program if you have not already done it. Probably the simplest way to is to get and run it direct from BoostPro, telling the installation which of the libraries (threads) you wish to install – you don't have to install all of them.
Go to the C:\Program Files\boost_1_46_1\tools\build\v2\engine\src directory and run build.bat from the command prompt. Running the build.bat script will create bjam.exe inside this directory:
C:\Program Files\boost_1_46_1\tools\build\v2\engine\src\bin.ntx86
Select the bjam.exe into in your PATH environment variables. Include the directory C:\Program Files\boost_1_46_1\tools\build\v2\engine\src\bin.ntx86 as another environment variable.
At the command prompt, go to the C:\Program Files\boost_1_46_1 directory, enter “bjam”, waiting for approximately 5-10 minutes while the program gets created.
In your Visual Studio project select Configuration Properties -> Linker -> Input -> Additional Dependencies and enter libboost_thread-vc100-mt-gd-1_46_1.lib.
In your Visual Studio project set the project configuration properties -> Linker -> General -> Additional Include Directories, telling it the location of the stage/lib folder eg C:\Program Files\Boost_1_46_1\stage\lib.
That should be sufficient to get you going. For more comprehensive details, please see this blog posting.
I was getting compile time error for 'boost::thread'. But it is resolved when I included following header.
#include <boost\thread.hpp>
Fatal Error C1083 is a Visual C++ error. You should include the library folder from boost in your project. "C:\Program Files\boost\boost_1_41\lib" if you're using boostpro.
Also when you're downloading the thread library with boostpro, you need to check it in the list (you can also choose the compiler...).