Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++, error: '__locale_t' has not been declared

Tags:

c++

c

eclipse

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:

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

This is the Abc class, nothing added except the 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 */
like image 794
betteroutthanin Avatar asked Mar 19 '23 01:03

betteroutthanin


1 Answers

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)

like image 197
Andre Holzner Avatar answered Mar 27 '23 22:03

Andre Holzner