这是什么意思:“错误:多个类型说明符的无效组合”
我在 FreeBSD 上遇到编译器错误:
error: invalid combination of multiple type-specifiers
来自 C++ 代码:
typedef unsigned off_t uoff_t;
不确定 gcc 编译器试图告诉我什么。
I'm getting a compiler error on FreeBSD:
error: invalid combination of multiple type-specifiers
From the C++ Code:
typedef unsigned off_t uoff_t;
Not sure what the gcc compiler is trying to tell me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非
off_t
是一个宏,否则它只是一个语法错误。unsigned
不能添加到 typedef 类型或用于修改此类类型。干杯&呵呵,,
Unless
off_t
is a macro, it's simply a syntax error.unsigned
is not something you can add to a typedef'ed type or use to modify such a type.Cheers & hth.,
使用 typedef std::make_unsigned_t
关闭_t> uoff_t;
Since C++14 改为实现想要的效果。使用 typedef std::make_unsigned
off_t >::type uoff_t;
自 C++11 起。使用 typedef boost::make_unsigned< off_t >::type uoff_t; 在 C++11 之前。
Use
typedef std::make_unsigned_t< off_t > uoff_t;
since C++14 instead to achieve the desired effect.Use
typedef std::make_unsigned< off_t >::type uoff_t;
since C++11.Use
typedef boost::make_unsigned< off_t >::type uoff_t;
before C++11.