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

时间:2022-03-27 22:42:13

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:

我正在研究一些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.

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!)

我检查了路径,他们没事。这个项目使用相同的包含路径使用VS2010构建良好(因为它们不以/ cygdrive为前缀!)

The LOC in question is simply

有问题的LOC很简单

#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.

我尝试使用类似DOS的路径规范而不是cygwin,但这产生了wierd包含路径。我在这个错误上看到的所有评论表明路径被搞砸了或没有设置或者其他东西,但是我使用VS所包含的相同包含文件的绝对路径,所以不确定发生了什么。

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.

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

2 个解决方案

#1


0  

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?)

根据手册页,Win32上的scons更喜欢使用MinGW工具链。它甚至可能不知道如何找到Cygwin g ++命令。 (你安装了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.

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

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

#2


0  

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.

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

#1


0  

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?)

根据手册页,Win32上的scons更喜欢使用MinGW工具链。它甚至可能不知道如何找到Cygwin g ++命令。 (你安装了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.

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

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

#2


0  

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.

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