找不到C ++ Boost文件 [英] C++ Boost not found file
问题描述
我正在尝试使用boost中的variant
,并且收到此错误:
I'm trying to use variant
from boost and I'm receiving this error:
严重错误C1083:无法打开包含文件:'boost/variant.hpp':否 这样的文件或目录
fatal error C1083: Cannot open include file: 'boost/variant.hpp': No such file or directory
我已将文件包含在项目属性中.
I've included the files in project properties.
在参考目录和图书馆目录中,我也尝试过使用
In the Reference Directories and Library Directories I've tried also with
- "... \ lib"
- ".... \ stage \ lib"
我还在包含目录中尝试过:
- "... \ boost_1_68_0"
- "... \ boost_1_68_0 \ boost"
在一开始,我使用了 D:\ Libs \ boost_1_68_0 \ libs ,并且因为它不起作用,所以我编译了boost并尝试使用<之后,strong> D:\ Libs \ boost_1_68_0 \ stage \ lib .
In the beginning, I used D:\Libs\boost_1_68_0\libs and because it didn't work I've compiled boost and I've tried with D:\Libs\boost_1_68_0\stage\lib after that.
但是没有成功.
此外,我应该说我在VisualStudio2010和2015年都曾尝试过此方法,并且我遵循了
Also, I should say that I've tried this in VisualStudio2010 and also in 2015 and I've followed this tutorial.
对我有解决方案吗?感谢您的建议:)
Any solution for me? Thanks in advice :)
推荐答案
您已将include设置为D:\Libs\boost_1_68_0\boost
.但是代码中的include看起来像<boost/variant.hpp>
.因此,如果您将include设置为D:\Libs\boost_1_68_0
,则<boost/whatever/...>
将从此开始.
You have set your include to D:\Libs\boost_1_68_0\boost
. But the includes in your code will look like <boost/variant.hpp>
. So if you set your include, instead, to D:\Libs\boost_1_68_0
then the <boost/whatever/...>
will follow from there.
您真正应该做的是将一个名为BOOST_ROOT
的环境变量设置为D:\Libs\boost_1_68_0
.然后在项目集中添加$(BOOST_ROOT)
的其他内容.请注意,必须重新启动Visual Studio才能使环境更改生效.
What you really should do is set an environment variable called BOOST_ROOT
to D:\Libs\boost_1_68_0
. Then in your project set additional includes with $(BOOST_ROOT)
Note that you have to restart Visual Studio for the environment change to take effect.
现在,将来boost_1_69出现时,您可以将其放置在所需的位置,并且在更新环境变量时,将使用以前使用过$(BOOST_ROOT)
的所有项目.
Now in the future, when boost_1_69 comes out, you can put it where ever you would like and all the previous projects where you have used $(BOOST_ROOT)
will follow when you up date the environment variable.
总是在/stage/lib
中构建您的boost库,这是b2
构建器的默认库.对于其他库,请使用$(BOOST_ROOT)/stage/lib
Always build your boost lib in /stage/lib
, it is the default for the b2
builder. And for your additional libs use $(BOOST_ROOT)/stage/lib
这篇关于找不到C ++ Boost文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!