与Visual Studio 2008一起使用Boost时出错

时间:2022-01-19 22:37:18

I am using Boost with Visual Studio 2008 and I have put the path to boost directory in configuration for the project in C++/General/"Additional Include Directories" and in Linker/General/"Additional Library Directories". (as it says here: http://www.boost.org/doc/libs/1_36_0/more/getting_started/windows.html#build-from-the-visual-studio-ide)

我在Visual Studio 2008中使用Boost,并且已经在C ++ / General /“Additional Include Directories”和Linker / General /“Additional Library Directories”中为项目配置了boost目录。 (正如它在这里所说:http://www.boost.org/doc/libs/1_36_0/more/getting_started/windows.html#build-from-the-visual-studio-ide)

When I build my program, I get an error:

当我构建我的程序时,我收到一个错误:

fatal error C1083: Cannot open include file: 'boost/python.hpp': No such file or directory

致命错误C1083:无法打开包含文件:'boost / python.hpp':没有这样的文件或目录

I have checked if the file exists, and it is on the path.

我已检查文件是否存在,并且它在路径上。

I would be grateful if anyone can solve this problem.

如果有人能解决这个问题,我将不胜感激。

The boost include path is C:\Program Files\boost\boost_1_36_0\boost.

增强包括路径是C:\ Program Files \ boost \ boost_1_36_0 \ boost。

Linker path is C:\Program Files\boost\boost_1_36_0\lib.

链接器路径为C:\ Program Files \ boost \ boost_1_36_0 \ lib。

The file python.hpp exists on the include path.

文件python.hpp存在于include路径中。

2 个解决方案

#1


Where is the file located, and which include path did you specify? (And how is the file #include'd)

文件位于何处,包括您指定的路径? (文件#include如何)

There's a mismatch between some of these But it's impossible to say what's wrong when you haven't shown what you actually did.

其中一些之间存在不匹配但是当你没有表现出你真正做过的事情时,不可能说出什么是错的。

Edit:

Given the paths you mentioned in comments, the problem is that they don't add up. If the include path is C:\Program Files\boost\boost_1_36_0\boost, and you then try to include 'boost/python.hpp", the compiler searches for this file in the include path, which means it looks for C:\Program Files\boost\boost_1_36_0\boost\boost\python.hpp, which doesn't exist.

鉴于您在评论中提到的路径,问题是它们没有加起来。如果包含路径是C:\ Program Files \ boost \ boost_1_36_0 \ boost,然后你尝试包含'boost / python.hpp',编译器会在include路径中搜索这个文件,这意味着它会查找C:\ Program Files \ boost \ boost_1_36_0 \ boost \ boost \ python.hpp,它不存在。

The include path should be set to C:\Program Files\boost\boost_1_36_0 instead.

包含路径应​​设置为C:\ Program Files \ boost \ boost_1_36_0。

#2


How do you include it? You should write something like this:

你怎么包括它?你应该写这样的东西:

#include <boost/python.hpp>

Note that Additional Include Directories settings are differs in Release and Debug configurations. You should make them the same.

请注意,“发布”和“调试”配置中的“其他包含目录”设置不同。你应该让他们一样。

If boost placed to C:\Program Files\boost\boost_1_36_0\ you should set path to C:\Program Files\boost\boost_1_36_0\ without boost in the end.

如果将升压放置到C:\ Program Files \ boost \ boost_1_36_0 \,则应将路径设置为C:\ Program Files \ boost \ boost_1_36_0 \,而不进行提升。

#1


Where is the file located, and which include path did you specify? (And how is the file #include'd)

文件位于何处,包括您指定的路径? (文件#include如何)

There's a mismatch between some of these But it's impossible to say what's wrong when you haven't shown what you actually did.

其中一些之间存在不匹配但是当你没有表现出你真正做过的事情时,不可能说出什么是错的。

Edit:

Given the paths you mentioned in comments, the problem is that they don't add up. If the include path is C:\Program Files\boost\boost_1_36_0\boost, and you then try to include 'boost/python.hpp", the compiler searches for this file in the include path, which means it looks for C:\Program Files\boost\boost_1_36_0\boost\boost\python.hpp, which doesn't exist.

鉴于您在评论中提到的路径,问题是它们没有加起来。如果包含路径是C:\ Program Files \ boost \ boost_1_36_0 \ boost,然后你尝试包含'boost / python.hpp',编译器会在include路径中搜索这个文件,这意味着它会查找C:\ Program Files \ boost \ boost_1_36_0 \ boost \ boost \ python.hpp,它不存在。

The include path should be set to C:\Program Files\boost\boost_1_36_0 instead.

包含路径应​​设置为C:\ Program Files \ boost \ boost_1_36_0。

#2


How do you include it? You should write something like this:

你怎么包括它?你应该写这样的东西:

#include <boost/python.hpp>

Note that Additional Include Directories settings are differs in Release and Debug configurations. You should make them the same.

请注意,“发布”和“调试”配置中的“其他包含目录”设置不同。你应该让他们一样。

If boost placed to C:\Program Files\boost\boost_1_36_0\ you should set path to C:\Program Files\boost\boost_1_36_0\ without boost in the end.

如果将升压放置到C:\ Program Files \ boost \ boost_1_36_0 \,则应将路径设置为C:\ Program Files \ boost \ boost_1_36_0 \,而不进行提升。