为 Eclipse 添加 Boost for C++ - 包括路径问题
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试这样:
#include <>和 #include "" 的处理方式不同。第一个表示“系统”包含路径,而第二个表示“用户”包含路径。
Try it like this:
#include <> and #include "" are handled differently. The first one means a "system" include path while the second one is for a "user" include path.
我遇到了同样的问题并经历了同样的困难(甚至尝试了“”而不是<>)。事实证明这个解决方案确实有点愚蠢。它是一台windows机器;请记住,它们处理文件路径的方式不同。
来自原始帖子:
更改斜杠方向,使其显示为:
(编辑包含路径;在项目属性 | 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:
Change the slash direction so that it reads:
(Edit the include path; under project Properties | C/C++ General | Paths and Symbols | Includes | GNU C++)
This solved the problem for me.