为 Eclipse 添加 Boost for C++ - 包括路径问题

发布于 2024-11-01 04:04:17 字数 1404 浏览 2 评论 0原文

我在 Windows 开发、GNU 和 C++ 方面经验丰富,但对 Eclipse 还很陌生。我正在尝试将 Boost 添加到我的 Eclipse 项目中,该项目是使用 GNU 在 Windows 上构建的(但适用于嵌入式处理器)工具链。

我在这里添加了 Boost:C:\altera\10.1\quartus\bin\cygwin\usr\include\boost_1_46_1

我已将该目录添加到我的 Eclipse 包含路径中(项目属性 | C/C++ 常规 | 路径和符号 | 包含 | GNU C++),我看到 C:\altera\10.1\quartus\bin\cygwin\usr\include 显示为内置目录。

我可以在 Eclipse Project Explorer 下浏览这些目录和文件,并从 Outline 中打开它们。然而,当我将它们包括在内时,它不起作用。

我的代码包含以下内容:

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>

Eclipse 生成的构建字符串如下所示(请注意缺少上面提到的两个目录):

nios2-elf-gcc -xc++ -MP -MMD -c -I../NiosIITestSpin_bsp/UCOSII/inc -I../NiosIITestSpin_bsp/HAL/inc -I../NiosIITestSpin_bsp -I../NiosIITestSpin_bsp/drivers/inc  -DSYSTEM_BUS_WIDTH=32 -pipe -D__hal__ -DALT_NO_INSTRUCTION_EMULATION -D__ucosii__      -O0 -g -Wall   -EL -mhw-div -mcustom-fpu-cfg=60-1 -mhw-mul -mhw-mulx  -o obj/Test.o Test.cpp

Test.cpp:12:41: warning: boost/property_tree/ptree.hpp: No such file or directory
Test.cpp:13:46: warning: boost/property_tree/xml_parser.hpp: No such file or directory

我清理、重新生成 makefile 并重建,但我无法让编译器看到这个新的包含目录。

如果我更改代码以包含完整路径,它会更进一步,它可以打开这些文件,但仍然无法打开它们包含的 Boost 文件。

我用谷歌搜索了 StackOverflow 和 Eclipse,但没有结果。有很多类似的问题,但没有一个是完全相同的或对我有用的。

有什么想法吗?

I'm experienced with Windows development, GNU, and C++, but I'm new to Eclipse. I'm trying to add Boost to my Eclipse project which is building on Windows (but for an embedded processor) with the GNU toolchain.

I have added Boost here: C:\altera\10.1\quartus\bin\cygwin\usr\include\boost_1_46_1

I have added that directory to my Eclipse include path (project Properties | C/C++ General | Paths and Symbols | Includes | GNU C++), where I see C:\altera\10.1\quartus\bin\cygwin\usr\include shows up as a built-in directory.

I can browse these directories and files under the Eclipse Project Explorer and open them up from the Outline. Yet, when I include them it doesn't work.

My code contains this:

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>

The Eclipse generated build string looks like this (note the lack of the two directories mentioned above):

nios2-elf-gcc -xc++ -MP -MMD -c -I../NiosIITestSpin_bsp/UCOSII/inc -I../NiosIITestSpin_bsp/HAL/inc -I../NiosIITestSpin_bsp -I../NiosIITestSpin_bsp/drivers/inc  -DSYSTEM_BUS_WIDTH=32 -pipe -D__hal__ -DALT_NO_INSTRUCTION_EMULATION -D__ucosii__      -O0 -g -Wall   -EL -mhw-div -mcustom-fpu-cfg=60-1 -mhw-mul -mhw-mulx  -o obj/Test.o Test.cpp

Test.cpp:12:41: warning: boost/property_tree/ptree.hpp: No such file or directory
Test.cpp:13:46: warning: boost/property_tree/xml_parser.hpp: No such file or directory

I clean, regen makefiles, and rebuild, but I can't get the compiler to see this new include directory.

If I change the code to include the full path, it gets a step further in that it can open those files, but it still can't open Boost files that they include.

I have googled and searched StackOverflow and Eclipse to no avail. There are lots of similar problems, but nothing that is quite the same or has worked for me.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寂寞清仓 2024-11-08 04:04:17

尝试这样:

#include "boost/property_tree/ptree.hpp"
#include "boost/property_tree/xml_parser.hpp"

#include <>和 #include "" 的处理方式不同。第一个表示“系统”包含路径,而第二个表示“用户”包含路径。

Try it like this:

#include "boost/property_tree/ptree.hpp"
#include "boost/property_tree/xml_parser.hpp"

#include <> and #include "" are handled differently. The first one means a "system" include path while the second one is for a "user" include path.

听,心雨的声音 2024-11-08 04:04:17

我遇到了同样的问题并经历了同样的困难(甚至尝试了“”而不是<>)。事实证明这个解决方案确实有点愚蠢。它是一台windows机器;请记住,它们处理文件路径的方式不同。

来自原始帖子:

C:\altera\10.1\quartus\bin\cygwin\usr\include\boost_1_46_1

更改斜杠方向,使其显示为:

c:/altera/10.1/quartus/bin/cygwin/usr/include/boost_1_46_1

(编辑包含路径;在项目属性 | C/C++ 常规 | 路径和符号 | 包含 | GNU C++ 下)

这为我解决了问题。

I had the same problem and jumped through the same hoops (even tried the "" instead of the <>). The solution turned out to be really kind of silly. It is a windows machine; remember that they handle file paths differently.

From the original post:

C:\altera\10.1\quartus\bin\cygwin\usr\include\boost_1_46_1

Change the slash direction so that it reads:

c:/altera/10.1/quartus/bin/cygwin/usr/include/boost_1_46_1

(Edit the include path; under project Properties | C/C++ General | Paths and Symbols | Includes | GNU C++)

This solved the problem for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文