简体   繁体   English

如何在项目中使用Boost库(VS2015)

[英]how to use boost libs in project (VS2015)

I have Visual Studio 2015 and I'm trying to build the sample boost 1.62 link program on the ' Boost Getting Started ' page. 我拥有Visual Studio 2015,并且试图在“ Boost入门 ”页面上构建示例boost 1.62链接程序。 I followed the build steps in order to compile the various binaries, like regex. 我遵循构建步骤来编译各种二进制文件,例如regex。 These are the steps: 这些步骤是:

c:\boost> bootstrap
c:\boost> .\b2

I got multiple errors because 'pyconfig.h' was missing, but I don't need this so I thought it was ok. 我遇到了多个错误,因为缺少'pyconfig.h',但是我不需要这个,所以我认为还可以。

I set the 'Additional Libraries Directory' in my test project to c:\\boost\\libs, but at link time, get: 我在测试项目中将“其他库目录”设置为c:\\ boost \\ libs,但是在链接时,获取:

error: cannot open file libboost_regex-vc140-mt-gd-1_62.lib

I looked under .\\libs and there were no lib files under there. 我在。\\ libs下查看,并且那里没有lib文件。 I did see a new bin.v2 directory under boost\\, which, under a very complicate tree has the lib file. 我确实在boost \\下看到了一个新的bin.v2目录,该目录在一个非常复杂的树下具有lib文件。

I set the 'Additional Libraries Directories' in my project to c:\\boost\\bin.v2, but same error. 我在项目中将“其他库目录”设置为c:\\ boost \\ bin.v2,但存在相同的错误。

Can anyone tell me what I need to do to be able to link successfully? 谁能告诉我要成功链接我需要做什么? Do I need to resolve that pyconfig.h error to get the libs deployed to the right location? 我是否需要解决该pyconfig.h错误,才能将库部署到正确的位置?

I found the problem. 我发现了问题。 It appears VC++ projects should add an include path to .\\boost\\stage\\lib, instead of what the boost webpage says. 看来VC ++项目应该向。\\ boost \\ stage \\ lib添加一个include路径,而不是boost网页所说的。 I don't know if this is true intention, but it appears to work. 我不知道这是否是真正的意图,但似乎可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM