g++尽管传入了绝对地址,但无法找到包含目录

发布于 2024-12-08 17:04:28 字数 1001 浏览 0 评论 0原文

我正在编写一些 C++ 代码,其中包括使用 tinyXML 进行一些小型 XML 解析。因为我了解 Python 但不了解 make,所以我使用 scons 并获得以下 scons 输出:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o Release-cygwin/SDLWin.o -c -ISDLWin -I/cygdrive/d/Jason/Projects/Libraries/tinyxml/2.6.2/
 -I/cygdrive/d/Jason/Projects/Libraries/boost-1.47.0/boost_1_47_0/
 -I/cygdrive/d/Jason/Projects/Libraries/sdl/1.2.14/include SDLWin/SDLWin.cpp
SDLWin/SDLWin.cpp:36:21: fatal error: tinyxml.h: No such file or directory
compilation terminated.
scons: *** [Release-cygwin/SDLWin.o] Error 1
scons: building terminated because of errors.

我已经检查了路径,它们没问题。这个项目使用 VS2010 使用相同的包含路径构建得很好(尽管它们没有以 /cygdrive 开头!)

有问题的 LOC 只是

#include "tinyxml.h"

我尝试使用类似 DOS 的路径规范而不是 cygwin,但这产生了奇怪的包含路径。我看到的关于此错误的所有评论都表明路径被搞砸了或未设置或其他什么,但我使用的是 VS 包含的同一包含文件的绝对路径,所以不确定发生了什么。

TIA, -J

编辑:我现在有一个 Ubuntu 11(64 位)虚拟机,并尝试使用 scons 构建代码,导致同样的问题。

I'm working on some C++ code that includes the use of tinyXML for some small XML parsing. Since I know Python but not make, I'm using scons and getting the following scons output:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o Release-cygwin/SDLWin.o -c -ISDLWin -I/cygdrive/d/Jason/Projects/Libraries/tinyxml/2.6.2/
 -I/cygdrive/d/Jason/Projects/Libraries/boost-1.47.0/boost_1_47_0/
 -I/cygdrive/d/Jason/Projects/Libraries/sdl/1.2.14/include SDLWin/SDLWin.cpp
SDLWin/SDLWin.cpp:36:21: fatal error: tinyxml.h: No such file or directory
compilation terminated.
scons: *** [Release-cygwin/SDLWin.o] Error 1
scons: building terminated because of errors.

I've checked the paths, and they are OK. This project builds fine using VS2010 using the same include paths (tho they aren't prefaced with /cygdrive!)

The LOC in question is simply

#include "tinyxml.h"

I tried with using the DOS-like path specifications instead of cygwin, but that produced wierd include paths instead. All the commentary I've seen on this error suggests that the paths are screwed up or not set or something, but I'm using absolute paths to the same include file that VS is including, so not sure what's going on.

TIA,
-J

Edit: I've now got an Ubuntu 11 (64-bit) vm and attempting to build the code using scons on that results in the same issue.

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

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

发布评论

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

评论(2

誰ツ都不明白 2024-12-15 17:04:28

根据 手册页scons< Win32 上的 /code> 更喜欢使用 MinGW 工具链。它甚至可能不知道如何找到 Cygwin g++ 命令。 (你安装了 MinGW 吗?)

如果我没记错的话,MinGW 使用 MSYS,它与 Cygwin 有一些相似之处,但(故意)能力要差得多。特别是,我认为 MSYS 将 D:\ Windows 驱动器称为 /D,而不是 /cygdrive/D

要么调整您的 SConscript 文件(以及源代码,如果需要)以与 MinGW 兼容,要么弄清楚如何使 scons 调用 Cygwin gcc 工具链。

According to the man page, scons on Win32 prefers to use the MinGW tool chain. It might not even know how to find the Cygwin g++ command. (Have you installed MinGW?)

If I recall correctly, MinGW uses MSYS, which has some similarities to Cygwin but is (deliberately) much less capable. In particular, I think MSYS refers to the D:\ Windows drive as /D, not /cygdrive/D.

Either adjust your SConscript files (and source code, if necessary) to be compatible with MinGW, or figure out how to make scons invoke the Cygwin gcc toolchain.

墨落画卷 2024-12-15 17:04:28

事实证明,cygwin、python、ubuntu 或 gcc 都没有问题。我从顶级目录调用 scons,但它会向下遍历目录级别到代码和 SConscript 文件...这意味着向下传递时路径不正确。实际的 -I 路径是相同的,但是在我用来设置 boost 等路径的环境变量前面添加了一个额外的“../”,意味着它有效。

The problem turns out none of cygwin, python, ubuntu or gcc. I call scons from the top-level directory, but it traverses down a directory level to the code and the SConscript file... which meant the paths weren't correct when passed down. The actual -I paths are the same, but adding an additional "../" on the front of the environment variables that I use to set the paths to boost, etc., meant that it worked.

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