使用4.9.2版本的交叉编译器编译新写的应用程序时,出现了很多之前没遇到过的编译错误,比如今晚出现的编译错误:error: ‘__locale_t’ has not been declared。这个错误主要是头文件“<xlocale.h>”包含的问题。
这个错误源于自己编写的一个头文件中包含了<string>头文件引起的。编译错误提示内容具体如下:
一、编译错误
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:183:5: error: ‘__locale_t’ has not been declared
__locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:186:18: error: ‘__locale_t’ has not been declared
size_t __n, __locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:207:9: error: ‘__locale_t’ has not been declared
__locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:213:17: error: ‘__locale_t’ has not been declared
size_t __n, __locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:532:6: error: ‘__locale_t’ has not been declared
__locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:536:21: error: ‘__locale_t’ has not been declared
int __base, __locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:541:17: error: ‘__locale_t’ has not been declared
int __base, __locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:546:20: error: ‘__locale_t’ has not been declared
int __base, __locale_t __loc)
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:550:35: error: ‘__locale_t’ has not been declared
wchar_t **__restrict __endptr, __locale_t __loc)
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:554:41: error: ‘__locale_t’ has not been declared
wchar_t **__restrict __endptr, __locale_t __loc)
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:559:10: error: ‘__locale_t’ has not been declared
__locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wchar.h:868:6: error: ‘__locale_t’ has not been declared
__locale_t __loc) __THROW;
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/clocale:42:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:41,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/localefwd.h:40,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/string:43,
from ../src/sysService/logger/socketOutputer.h:15,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/locale.h:151:8: error: ‘__locale_t’ does not name a type
extern __locale_t newlocale (int __category_mask, const char *__locale,
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/locale.h:186:8: error: ‘__locale_t’ does not name a type
extern __locale_t duplocale (__locale_t __dataset) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/locale.h:190:25: error: variable or field ‘freelocale’ declared void
extern void freelocale (__locale_t __dataset) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/locale.h:190:25: error: ‘__locale_t’ was not declared in this scope
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/locale.h:190:25: note: suggested alternative:
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/string.h:163:0,
from ../include/fwGlobal.h:173,
from ../include/fwSockUdp.h:20,
from ../src/sysService/logger/socketOutputer.cpp:13:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/xlocale.h:39:4: note: ‘Fwb::__locale_t’
} *__locale_t;
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/clocale:42:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:41,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/localefwd.h:40,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/string:43,
from ../src/sysService/logger/socketOutputer.h:15,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/locale.h:197:8: error: ‘__locale_t’ does not name a type
extern __locale_t uselocale (__locale_t __dataset) __THROW;
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/localefwd.h:40:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/string:43,
from ../src/sysService/logger/socketOutputer.h:15,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:52:23: error: ‘uselocale’ was not declared in this scope
extern “C” __typeof(uselocale) __uselocale;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:52:45: error: invalid type in declaration before ‘;’ token
extern “C” __typeof(uselocale) __uselocale;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:62:11: error: ‘__locale_t’ does not name a type
typedef __locale_t __c_locale;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:69:26: error: ‘__c_locale’ does not name a type
__convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)),
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h: In function ‘int std::__convert_from_v(const int&, char*, int, const char*, …)’:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:75:5: error: ‘__c_locale’ was not declared in this scope
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:100:28: error: ‘__old’ was not declared in this scope
__gnu_cxx::__uselocale(__old);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/c++locale.h:100:33: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__gnu_cxx::__uselocale(__old);
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/cctype:42:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/localefwd.h:42,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/string:43,
from ../src/sysService/logger/socketOutputer.h:15,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h: At global scope:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:271:1: error: ‘__locale_t’ has not been declared
__exctype_l (isalnum_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:272:1: error: ‘__locale_t’ has not been declared
__exctype_l (isalpha_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:273:1: error: ‘__locale_t’ has not been declared
__exctype_l (iscntrl_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:274:1: error: ‘__locale_t’ has not been declared
__exctype_l (isdigit_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:275:1: error: ‘__locale_t’ has not been declared
__exctype_l (islower_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:276:1: error: ‘__locale_t’ has not been declared
__exctype_l (isgraph_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:277:1: error: ‘__locale_t’ has not been declared
__exctype_l (isprint_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:278:1: error: ‘__locale_t’ has not been declared
__exctype_l (ispunct_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:279:1: error: ‘__locale_t’ has not been declared
__exctype_l (isspace_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:280:1: error: ‘__locale_t’ has not been declared
__exctype_l (isupper_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:281:1: error: ‘__locale_t’ has not been declared
__exctype_l (isxdigit_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:283:1: error: ‘__locale_t’ has not been declared
__exctype_l (isblank_l);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:287:34: error: ‘__locale_t’ has not been declared
extern int __tolower_l (int __c, __locale_t __l) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:288:32: error: ‘__locale_t’ has not been declared
extern int tolower_l (int __c, __locale_t __l) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:291:34: error: ‘__locale_t’ has not been declared
extern int __toupper_l (int __c, __locale_t __l) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/ctype.h:292:32: error: ‘__locale_t’ has not been declared
extern int toupper_l (int __c, __locale_t __l) __THROW;
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/pthread.h:24:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/gthr-default.h:35,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/arm-linux-gnueabihf/bits/gthr.h:148,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/ext/atomicity.h:35,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/basic_string.h:39,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/string:52,
from ../src/sysService/logger/socketOutputer.h:15,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/time.h:226:6: error: ‘__locale_t’ has not been declared
__locale_t __loc) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/time.h:232:5: error: ‘__locale_t’ has not been declared
__locale_t __loc) __THROW;
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/ios_base.h:41:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/ios:42,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/istream:38,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/sstream:38,
from ../include/fwLogger.h:16,
from ../src/sysService/logger/outputerIf.h:16,
from ../src/sysService/logger/socketOutputer.h:17,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:347:12: error: ‘__c_locale’ does not name a type
static __c_locale _S_c_locale;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:378:24: error: ‘__c_locale’ has not been declared
_S_create_c_locale(__c_locale& __cloc, const char* __s,
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:379:10: error: ‘__c_locale’ has not been declared
__c_locale __old = 0);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:381:12: error: ‘__c_locale’ does not name a type
static __c_locale
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:385:25: error: ‘__c_locale’ has not been declared
_S_destroy_c_locale(__c_locale& __cloc);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:387:12: error: ‘__c_locale’ does not name a type
static __c_locale
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:392:12: error: ‘__c_locale’ does not name a type
static __c_locale
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:597:7: error: ‘__c_locale’ does not name a type
__c_locale _M_c_locale_collate;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:625:26: error: expected ‘)’ before ‘__cloc’
collate(__c_locale __cloc, size_t __refs = 0)
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h: In constructor ‘std::collate<_CharT>::collate(std::size_t)’:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:612:24: error: class ‘std::collate<_CharT>’ does not have any field named ‘_M_c_locale_collate’
: facet(__refs), _M_c_locale_collate(_S_get_c_locale())
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:612:60: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available [-fpermissive]
: facet(__refs), _M_c_locale_collate(_S_get_c_locale())
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:612:60: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h: In destructor ‘virtual std::collate<_CharT>::~collate()’:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_classes.h:689:29: error: ‘_M_c_locale_collate’ was not declared in this scope
{ _S_destroy_c_locale(_M_c_locale_collate); }
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/cwctype:50:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:39,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/basic_ios.h:37,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/ios:44,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/istream:38,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/sstream:38,
from ../include/fwLogger.h:16,
from ../src/sysService/logger/outputerIf.h:16,
from ../src/sysService/logger/socketOutputer.h:17,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h: At global scope:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:230:37: error: ‘__locale_t’ has not been declared
extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:236:37: error: ‘__locale_t’ has not been declared
extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:239:37: error: ‘__locale_t’ has not been declared
extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:243:37: error: ‘__locale_t’ has not been declared
extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:247:37: error: ‘__locale_t’ has not been declared
extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:252:37: error: ‘__locale_t’ has not been declared
extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:255:37: error: ‘__locale_t’ has not been declared
extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:260:37: error: ‘__locale_t’ has not been declared
extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:265:37: error: ‘__locale_t’ has not been declared
extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:270:37: error: ‘__locale_t’ has not been declared
extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:275:38: error: ‘__locale_t’ has not been declared
extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:280:37: error: ‘__locale_t’ has not been declared
extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:284:51: error: ‘__locale_t’ has not been declared
extern wctype_t wctype_l (const char *__property, __locale_t __locale)
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:289:54: error: ‘__locale_t’ has not been declared
extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:298:40: error: ‘__locale_t’ has not been declared
extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:301:40: error: ‘__locale_t’ has not been declared
extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:305:53: error: ‘__locale_t’ has not been declared
extern wctrans_t wctrans_l (const char *__property, __locale_t __locale)
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/libc/usr/include/wctype.h:310:7: error: ‘__locale_t’ has not been declared
__locale_t __locale) __THROW;
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/basic_ios.h:37:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/ios:44,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/istream:38,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/sstream:38,
from ../include/fwLogger.h:16,
from ../src/sysService/logger/outputerIf.h:16,
from ../src/sysService/logger/socketOutputer.h:17,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:67:12: error: ‘__c_locale’ does not name a type
const __c_locale&) throw();
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:73:12: error: ‘__c_locale’ does not name a type
const __c_locale&) throw();
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:78:12: error: ‘__c_locale’ does not name a type
const __c_locale&) throw();
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:83:12: error: ‘__c_locale’ does not name a type
const __c_locale&) throw();
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:683:7: error: ‘__c_locale’ does not name a type
__c_locale _M_c_locale_ctype;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:724:24: error: expected ‘)’ before ‘__cloc’
ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false,
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1184:7: error: ‘__c_locale’ does not name a type
__c_locale _M_c_locale_ctype;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1219:24: error: expected ‘)’ before ‘__cloc’
ctype(__c_locale __cloc, size_t __refs = 0);
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/basic_ios.h:37:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/ios:44,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/istream:38,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/sstream:38,
from ../include/fwLogger.h:16,
from ../src/sysService/logger/outputerIf.h:16,
from ../src/sysService/logger/socketOutputer.h:17,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1693:27: error: expected ‘)’ before ‘__cloc’
numpunct(__c_locale __cloc, size_t __refs = 0)
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1850:30: error: ‘__c_locale’ has not been declared
_M_initialize_numpunct(__c_locale __cloc = 0);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1861:44: error: variable or field ‘_M_initialize_numpunct’ declared void
numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1861:44: error: ‘__c_locale’ was not declared in this scope
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1869:47: error: variable or field ‘_M_initialize_numpunct’ declared void
numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1869:47: error: ‘__c_locale’ was not declared in this scope
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h: In constructor ‘std::numpunct_byname<_CharT>::numpunct_byname(const char*, std::size_t)’:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1887:6: error: ‘__c_locale’ was not declared in this scope
__c_locale __tmp;
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:1888:31: error: ‘__tmp’ was not declared in this scope
this->_S_create_c_locale(__tmp, __s);
^
In file included from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.h:2608:0,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/basic_ios.h:37,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/ios:44,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/istream:38,
from /home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/sstream:38,
from ../include/fwLogger.h:16,
from ../src/sysService/logger/outputerIf.h:16,
from ../src/sysService/logger/socketOutputer.h:17,
from ../src/sysService/logger/socketOutputer.cpp:14:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc: In member function ‘virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, float&) const’:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc:692:71: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available [-fpermissive]
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc: In member function ‘virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, double&) const’:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc:707:71: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available [-fpermissive]
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc: In member function ‘virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, long double&) const’:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc:739:71: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available [-fpermissive]
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc: In member function ‘_OutIter std::num_put<_CharT, _OutIter>::_M_insert_float(_OutIter, std::ios_base&, _CharT, char, _ValueT) const’:
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc:995:48: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available [-fpermissive]
__len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
^
/home/vmuser/armlinux/1_tool/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/include/c++/4.9.2/bits/locale_facets.tcc:1003:52: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available [-fpermissive]
__len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
二、解决方法
首先打开交叉编译器的wchar.h并找到183行,内容如下:
#ifdef __USE_XOPEN2K8 /* Compare S1 and S2, ignoring case. */ extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW; /* Compare no more than N chars of S1 and S2, ignoring case. */ extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) __THROW; /* Similar to the two functions above but take the information from the provided locale and not the global locale. */ # include <xlocale.h> extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2, __locale_t __loc) __THROW; extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2, size_t __n, __locale_t __loc) __THROW; #endif
里面有用到__locale_t,注意,这部分代码是由__USE_XOPEN2K8宏来决定是否编译的。而且里面有# include <xlocale.h>。这个头文件里面有__locale_t定义的。不知道为啥还会报错。
根据:https://stackoverflow.com/questions/24738059/c-error-locale-t-has-not-been-declared和https://sourceware.org/bugzilla/show_bug.cgi?id=10456描述,
这两个链接里面的描述方法,还是解决不了问题的。
后面依据这个链接提供的思路解决问题:http://blog.sina.com.cn/s/blog_77f1e27f0100qum7.html
本人解决问题的方法为:在对应的头文件中加入下面代码:
#ifdef __USE_GNU #include <xlocale.h> #endif
学习了