#pragmaonce导致诡异编译错误
(2023-09-20 15:35:32)
标签:
it |
分类: 编程技术 |
windows平台报错(Visual Studio)
from
/usr/include/c++/4.8.2/ext/atomicity.h:35,
from
/usr/include/c++/4.8.2/bits/basic_string.h:39,
from
/usr/include/c++/4.8.2/string:52,
__gthrw(pthread_once)
^
extern int pthread_once (pthread_once_t
*__once_control,
error C2039: "toupper": 不是 "`global namespace'" 的成员
存在大量类似报错,涉及
isnum、isalpha等
linux平台下g++编译报错
In file included from
/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/gthr.h:148:0,
/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/gthr-default.h:101:1:
error: ‘pthread_once’ was not declared in this scope
/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/gthr-default.h:101:1:
note: suggested alternative:
In file included from
/usr/include/pthread.h:488:12: note:
‘zscom::pthread_once’
将所有头文件中的#pragma once 替换为传统的
#if !defined(XXX)
#define XXX
#endif
编译通过