C++,错误 : '__locale_t' has not been declared

标签 c++ c eclipse

我是 C++ 新手,我得到了 error: '__locale_t' has not been declared当我包含一些头文件时,比如 #include "ruby.h" , #include <string.h>等等,但是#include <stdio.h>没问题,我在linux下用eclipse,详细报错为#include "ruby.h"#include <string.h>是:

/usr/include/string.h:548: error: '__locale_t' has not been declared
/usr/include/string.h:549: error: nonnull argument references non-pointer operand (argument 1, operand 3)
/usr/include/string.h:552: error: '__locale_t' has not been declared
/usr/include/string.h:553: error: nonnull argument references non-pointer operand (argument 1, operand 4)

包含的顺序是:

#include "Abc.h"

#include <string.h>
#include "ruby.h"
#include <stdio.h>

在哪里Abc是类名。

这是 Abc类,除了 include 之外没有添加任何内容:

#include "Abc.h"
#include <stdio.h>
#include <string.h>
#include "ruby.h"

#include "ose_gw.h"

namespace a {

Abc::Abc() {
    // TODO Auto-generated constructor stub
}

Abc::~Abc() {
    // TODO Auto-generated destructor stub
}

} /* namespace a */

最佳答案

尝试编译:

g++ -D__USE_XOPEN2K8 ...

(另请参阅 https://sourceware.org/bugzilla/show_bug.cgi?id=10456,其中提到 xlocale.h 仅在定义了 __USE_XOPEN2K8 时包含在 string.h 中)

关于C++,错误 : '__locale_t' has not been declared,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24738059/

相关文章:

JavaScript 文件默认模板在 Java EE Eclipse 中不起作用

Java - OpenCv - JavaCv

c++ - skipper 在 boost::spirit 中不起作用

c++ - C++ 中 std::resize(n) 和 std::shrink_to_fit 的区别?

c++ - 可变长度数据和零长度数组的二进制序列化,安全吗?

C++ 单行注释后跟\transforms 在多行注释中

arrays - 动态分配内存到数组并读取大文本文件

c++ - 在 C++ 中拆分和合并 std::list

c - realloc 设置所有索引相同的数据

android - 为不同的 Activity 实现 admob