开发者

How to include boost::filesystem into a VS2010 project without adding a dependency on bjam?

开发者 https://www.devze.com 2023-02-19 22:22 出处:网络
According to this answer, the intended way to include non-header-only parts of Boost into a Visual Studio 2010 project require the use of bjam to build the correct libraries.

According to this answer, the intended way to include non-header-only parts of Boost into a Visual Studio 2010 project require the use of bjam to build the correct libraries.

What is unclear to me is whether this is a one-time-only thing, where I just check in the lib files produced by bjam, or whether anyone who wants to build my project will from now on require not only Visual Studio but also bjam.

The project only targets Windows 32-bits, because it builds a plugin for a program that's only available in this开发者_如何学C configuration, and only needs to support the statically-linked multi-threaded CRT.

(For the record, if I just include the relevant .cpp files into the build, the compile stage succeeds, but at link stage I get a missing library error, which is apparently caused by the "auto-link" feature. Perhaps I should just disable auto-linking, if it's possible?)


You don't need bjam. Like yasouser answered, you can download the installer from boost pro, the downsides being that

  • you need to register though that's quick and easy
  • it's usually/sometimes a release or two behind the latest boost release.

What is unclear to me is whether this is a one-time-only thing, where I just check in the lib files produced by bjam, or whether anyone who wants to build my project will from now on require not only Visual Studio but also bjam.

It is a one time thing per machine. Once you have the boost binaries you don't need bjam anymore. The nice thing about the installer is that you can install some selected versions of the boost libraries + the headers (You can select VS version, single-threaded, static/dynamic, etc. on a per library basis e.g. thread, system, etc.) and then at a later point you can just run the installer again and add other binaries.

So if you're auto-linking and are missing a specific lib, just run the installer again. FYI, you can disable boost's autolinking option by defining BOOST_ALL_NO_LIB and then manually linking in the lib versions you want.


Some of the boost libraries require you to build them as static or shared libraries and link them in your project. Either you can download the source and build it for yourself using bjam or you can install the pre-built binaries from here.

Yes this is a one time install (if you are installing from pre-built binaries or built by yourself). And those building your project will also need to do the boost install once for them to be able to build your project.


if I just include the relevant .cpp files into the build

Direct including cpp files has many drawbacks. The only reason of borrowing .cpp files I can imagine is to allow build the project on other PCs without installing boost there. But I think it can be solved by distributing particular boost .lib files as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消