Compile libtorrent for VS2005

本文介绍如何使用Boost和Visual Studio 2005编译Libtorrent,包括设置环境变量、配置文件、解决常见错误等详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Prerequisites

  1. Download boost from boost.org
  2. Download libtorrent
  3. Extract both to a folder called libtorrent

Compiling boost for VS.NET 2005

  1. Copy bjam.exe to libtorrent/boost_[version]/tools/build
  2. Add the path “libtorrent/boost_[version]/tools/build” to the windows path environment variable
  3. Log off / log back on
  4. Open the file “libtorrent/boost_[version]/tools/build/user-config.jam” in notepad
  5. Uncomment the # using msvc; line by removing the #
  6. Replace the line with: using vc-8_0 ;
  7. Save the file and close it
  8. Open the visual studio .net command line in the VS.net 2005 folder in your start menu
  9. CD to the “libtorrent/boost_[version]” folder
  10. Type: bjam “-sTOOLS=vc-8_0″ install and hit enter
  11. 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

  1. 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.

  2. 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

  3. Include all .c files in the zlib folder.

  4. Add the following Additional Include Header Files:

    "libtorrent/include"
    "C:/Boost/include/boost-1_33_1"
    "libtorrent/zlib"
    "libtorrent/include/libtorrent"
  5. 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
  6. Add C:/Boost/lib to Additional Library Directories

  7. Add the following Additional Dependencies:

    wsock32.lib
    libboost_thread-vc80-mt.lib
    libboost_filesystem-vc80-mt.lib
    libboost_date_time-vc80-mt.lib
  8. 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值