Boost库无法在C ++中工作,包含目录不起作用 [英] Boost Library cannot get to work in C++, Include directories not working

查看:326
本文介绍了Boost库无法在C ++中工作,包含目录不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试在C ++ 14中安装Boost库,并添加了它的包含路径,如:

I recently tried to install boost libraries in C++ 14, and I added it's include paths like:

解决方案资源管理器>项目名称>属性页> VC ++目录>"C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ boost \ boost"

添加此代码后,我尝试进行编译:

I tried to compile after adding this:

#include <boost\variant.hpp>

在错误列表"窗口中,我可以看到E1696 - cannot open source file "boost\variant.hpp",并且无法像以前那样进行编译.

In Error List window, I can see E1696 - cannot open source file "boost\variant.hpp" and I can't compile like before.

然后,我尝试添加反斜杠,例如"C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ boost \ boost \" ,仍然无法正常工作.

Then I tried with adding a backslash like "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\", still didn't work.

我还阅读了发布并明确指定它的目录,但甚至不起作用.

I also read this post and explicitly specified it's directory, but even didn't work.

再次,我阅读了这篇帖子,其内容完全相同给定答案(因为我已经多次构建项目),但仍然没有成功.

Again, I read this post and did exactly same what is in given answer (as I already built project several times) , but still no success.

但是,如果我包括一个像这样的图书馆:

However, if I include a library like:

#include "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\variant.hpp"

现在编译器可以识别它,但是现在我可以在错误列表"窗口中看到100多个错误,这些错误是指向boost库的头文件的,而不是包含在我的包含variant.hpp的项目文件中.

Now compiler recognizes it, but now I can see more than 100 errors in Error List window, those errors are pointed to header files of boost libraries, not in my project file which has variant.hpp included.

所有这些错误是E1696 - cannot open source file "boost\<libraryname.hpp>"E1696 - cannot open source file "boost\<subdirs>\<some other files included in libraryname.hpp>"

因此,如果我从项目的头文件中删除行#include "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\variant.hpp",则所有错误突然消失并且项目编译正常!现在没有任何错误!

So, if I remove the line #include "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\variant.hpp" from my project's header file, all errors disappear suddenly and project compiles fine! no any single error now!

无论如何我都希望Boost能够工作,所以我可以在项目中使用它,但是我不能手动编辑所有这些头文件并将<boost\...更改为原始位置.

I want boost to work anyway, so I can use it in projects, but I can't manually edit all those header files and change <boost\... to original locations.

请帮助我摆脱这个问题.

Please help me to get rid of this issue.

推荐答案

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆