Prerequisites
- Download boost from boost.org
- Download libtorrent
- Extract both to a folder called libtorrent
Compiling boost for VS.NET 2005
- Copy bjam.exe to libtorrent/boost_[version]/tools/build
- Add the path “libtorrent/boost_[version]/tools/build” to the windows path environment variable
- Log off / log back on
- Open the file “libtorrent/boost_[version]/tools/build/user-config.jam” in notepad
- Uncomment the # using msvc; line by removing the #
- Replace the line with: using vc-8_0 ;
- Save the file and close it
- Open the visual studio .net command line in the VS.net 2005 folder in your start menu
- CD to the “libtorrent/boost_[version]” folder
- Type: bjam “-sTOOLS=vc-8_0″ install and hit enter
- Be patient and wait for it to finish
Troubleshooting
- Make sure to CD to the root of the boost directory before running the install.
- For additional details and information on using Visual Studio 2005 Express addition, see the Boost Getting Started Guide.
Setting up and compiling libtorrent with VS.NET 2005
-
Create a new vs.net 2005 MFC project and solution file in the root of the libtorrent folder where you extracted all of the libtorrent files.
-
Include the files contained in the src folder, excluding the makefiles. NOTE: Only include either file.cpp or file_win.cpp. Read here to determine which file to include: http://www.rasterbar.com/products/libtorrent/docs.html#building-with-other-build-systems
-
Include all .c files in the zlib folder.
-
Add the following Additional Include Header Files:
"libtorrent/include"
"C:/Boost/include/boost-1_33_1"
"libtorrent/zlib"
"libtorrent/include/libtorrent" -
Add the following Preprocessor Definitions:
WIN32
WIN32_LEAN_AND_MEAN
_WIN32_WINNT=0x0500
BOOST_ALL_NO_LIB
_FILE_OFFSET_BITS=64
BOOST_THREAD_USE_LIB
TORRENT_BUILDING_SHARED
TORRENT_LINKING_SHARED
UNICODE -
Add C:/Boost/lib to Additional Library Directories
-
Add the following Additional Dependencies:
wsock32.lib
libboost_thread-vc80-mt.lib
libboost_filesystem-vc80-mt.lib
libboost_date_time-vc80-mt.lib -
Set the Runtime Library to Multi-threaded Debug DLL (/MDd) under the code generation section.
Troubleshooting
-
Error: error LNK2005:already defined etc…
- Make sure you use the Multi-threaded Debug DLL (/MDd) Error: error linking zlib related files…
- Make sure to include all .c files in the zlib folder. Runtime error in client_test.exe
- If you’re using boost-1.33.1, there is a bug in the program options library which will make VS.NET 2005 assert. For a patch, see: http://thread.gmane.org/gmane.comp.lib.boost.devel/140932/focus=140932
Additional Link:http://www.rasterbar.com/products/libtorrent/building.html