我是 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/