VS2008编译出现问题:error C2485: “__restrict”: 无法识别的扩展属性 解决办法(转)

在使用VC编译开源库时遇到Error3errorC2485,原因是不识别__restrict扩展属性。解决方案是查找并注释掉#definerestrict__restrict的行,因为VC本身已经支持restrict,不需要额外的__restrict。

错误:Error3 error C2485: '__restrict' : unrecognized extended attribute f:\program files\microsoft visual studio 8\vc\include\stdlib.h 638 


解决办法:我在用VC编译某开源库时也遇到这个问题
参考这个帖子
http://www.codeproject.com/Messages/2651289/Re-i-got-a-compiling-error-like-error-C2485-__rest.aspx

搜索"#define restrict __restrict",然后将之注释即可,似乎VC本身已经有restrict,而不含__restrict

转自:https://www.cnblogs.com/vcerror/p/4289104.html

usr/include/stdlib.h:98:1: warning: ‘leaf’ attribute has no effect on unit local functions [-Wattributes] /usr/include/stdlib.h:102:15: error: storage class specified for parameter ‘atof’ 102 | extern double atof (const char *__nptr) | ^~~~ /usr/include/stdlib.h:103:6: warning: ‘nothrow’ attribute ignored [-Wattributes] 103 | __THROW __attribute_pure__ __nonnull ((1)) __wur; | ^~~~~~~ /usr/include/stdlib.h:103:6: warning: ‘leaf’ attribute ignored [-Wattributes] /usr/include/stdlib.h:103:6: warning: ‘leaf’ attribute has no effect on unit local functions [-Wattributes] /usr/include/stdlib.h:103:6: warning: ‘pure’ attribute ignored [-Wattributes] /usr/include/stdlib.h:105:12: error: storage class specified for parameter ‘atoi’ 105 | extern int atoi (const char *__nptr) | ^~~~ /usr/include/stdlib.h:106:6: warning: ‘nothrow’ attribute ignored [-Wattributes] 106 | __THROW __attribute_pure__ __nonnull ((1)) __wur; | ^~~~~~~ /usr/include/stdlib.h:106:6: warning: ‘leaf’ attribute ignored [-Wattributes] /usr/include/stdlib.h:106:6: warning: ‘leaf’ attribute has no effect on unit local functions [-Wattributes] /usr/include/stdlib.h:106:6: warning: ‘pure’ attribute ignored [-Wattributes] /usr/include/stdlib.h:108:17: error: storage class specified for parameter ‘atol’ 108 | extern long int atol (const char *__nptr) | ^~~~ /usr/include/stdlib.h:109:6: warning: ‘nothrow’ attribute ignored [-Wattributes] 109 | __THROW __attribute_pure__ __nonnull ((1)) __wur; | ^~~~~~~ /usr/include/stdlib.h:109:6: warning: ‘leaf’ attribute ignored [-Wattributes] /usr/include/stdlib.h:109:6: warning: ‘leaf’ attribute has no effect on unit local functions [-Wattributes] /usr/include/stdlib.h:109:6: warning: ‘pure’ attribute ignored [-Wattributes] /usr/include/stdlib.h:113:1: error: expected declaration specifiers before ‘__extension__’ 113 | __extension__ extern long long int atoll (const char *__nptr) | ^~~~~~~~~~~~~ /usr/include/stdlib.h:118:15: error: storage class specified for parameter ‘strtod’ 118 | extern double strtod (const char *__restrict __nptr, | ^~~~~~ /usr/include/stdlib.h:120:6: warning: ‘nothrow’ attribute ignored [-Wattributes] 120 | __THROW __nonnull ((1)); | ^~~~~~~ /usr/include/stdlib.h:120:6: warning: ‘leaf’ attribute ignored [-Wattributes] /usr/include/stdlib.h:120:6: warning: ‘leaf’ attribute has no effect on unit local functions [-Wattributes] /usr/include/stdlib.h:124:14: error: storage class specified for parameter ‘strtof’ 124 | extern float strtof (const char *__restrict __nptr, | ^~~~~~ /usr/include/stdlib.h:125:8: warning: ‘nothrow’ attribute ignored [-Wattributes] 125 | char **__restrict __endptr) __THROW __nonnull ((1)); | ^~~~ /usr/include/stdlib.h:125:8: warning: ‘leaf’ attribute ignored [-Wattributes] /usr/include/stdlib.h:125:8: warning: ‘leaf’ attribute has no effect on unit local functions [-Wattributes] /usr/include/stdlib.h:127:20: error: storage class specified for parameter ‘strtold’ 127 | extern long double strtold (const char *__restrict __nptr, | ^~~~~~~ /usr/include/stdlib.h:129:6: warning: ‘nothrow’ attribute ignored [-Wattributes] 129 | __THROW __nonnull ((1)); | ^~~~~~~ /usr/include/stdlib.h:129:6: warning: ‘leaf’ attribute ignored [-Wattributes] /usr/include/stdlib.h:129:6: warning: ‘leaf’ attribute has no effect on unit local functions [-Wattributes]
11-06
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值