加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

#pragmaonce导致诡异编译错误

(2023-09-20 15:35:32)
标签:

it

分类: 编程技术
windows平台报错(Visual Studio)
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,
                 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,
/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
 __gthrw(pthread_once)
 ^
/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’
 extern int pthread_once (pthread_once_t *__once_control,

将所有头文件中的#pragma once 替换为传统的
#if !defined(XXX)
#define XXX
#endif

编译通过

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有