为什么我不能编译以下内容?

时间:2012-01-04 15:55:20

标签: macos g++

我正在尝试编译我从这里获得的包:http://sourceforge.net/projects/desr/

在带有SDK 10.6或10.7的MacOSX上(我在/ Developer中都有)。

我收到以下错误:

g++  -g -O2  -I. -I.. -I../ixe -c charmap.cpp
g++  -g -O2  -I. -I.. -I../ixe -c HtmlTokenizer.cpp
In file included from /usr/include/c++/4.2.1/iosfwd:45,
             from /usr/include/c++/4.2.1/bits/stl_algobase.h:70,
             from /usr/include/c++/4.2.1/bits/char_traits.h:46,
             from /usr/include/c++/4.2.1/string:47,
             from ./Char.h:30,
             from ./string.h:27,
             from /usr/include/c++/4.2.1/cstring:52,
             from HtmlTokenizer.cpp:24:
/usr/include/c++/4.2.1/bits/c++locale.h: In function ‘int std::__convert_from_v(int* const&, char*, int, const char*, ...)’:
/usr/include/c++/4.2.1/bits/c++locale.h:69: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2.1/bits/c++locale.h:71: error: ‘strlen’ is not a member of ‘std’
/usr/include/c++/4.2.1/bits/c++locale.h:72: error: ‘strcpy’ is not a member of ‘std’

我在网上看到它,似乎其他论坛中指定的原因都不是这种情况下的原因(例如缺少“cstring”include或命名空间定义中的include)。

我知道我在Linux上编译了这个软件包,所以我想我的Mac OSX xcode安装已经坏了(??)或xcode对这个软件包中的某些错误很敏感,而Linux环境却没有。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

本地包含文件"string.h"正在屏蔽系统<string.h>。通常,这是由需要区分大小写的FS并使用String.h等文件名的项目引起的,这些文件名与不区分大小写的FSes(这是OS X上的默认值)系统冲突。

如果问题确实是不区分大小写的,你可以a)修复项目不要使用这种愚蠢的名字,或者b)创建一个用区分大小写的HFS +格式化的磁盘映像,并在那里编译项目。

相关问题