简体   繁体   English

C ++,错误:'__locale_t'尚未声明

[英]C++, error: '__locale_t' has not been declared

I'm new to C++, I got error: '__locale_t' has not been declared when I included some header files, like #include "ruby.h" , #include <string.h> and so on, but there's no problem for #include <stdio.h> , I'm using eclipse under Linux, the detailed error for #include "ruby.h" and #include <string.h> is: 我是C ++ error: '__locale_t' has not been declared ,我收到error: '__locale_t' has not been declared当我包含一些头文件时, 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)

The order of the include is: 包含的顺序是:

#include "Abc.h"

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

Where Abc is the class name. 其中Abc是班级名称。

This is the Abc class, nothing added except the include : 这是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 */

Try compiling with: 尝试编译:

g++ -D__USE_XOPEN2K8 ...

(see also https://sourceware.org/bugzilla/show_bug.cgi?id=10456 which mentions that xlocale.h is only included from string.h when __USE_XOPEN2K8 is defined) (也参见https://sourceware.org/bugzilla/show_bug.cgi?id=10456其中提到xlocale.h仅从包含string.h__USE_XOPEN2K8定义)

This is apparently a known issue, which was logged as a bug but is actually some kind of subtle configuration error. 这显然是一个已知的问题,它被记录为一个错误,但实际上是某种微妙的配置错误。

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52922 请参阅https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52922

I'm a Windows guy and this is out of my league, but the answer is in there somewhere (I think). 我是一个Windows家伙,这不属于我的联盟,但答案是在某处(我认为)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM