【问题标题】:avr-gcc: warning: 'overloadable' attribute directive ignored [-Wattributes]avr-gcc: 警告: 'overloadable' 属性指令被忽略 [-Wattributes]
【发布时间】:2021-12-28 18:21:37
【问题描述】:

我有一个函数,我需要重载,但编译器忽略并稍后给我一个错误:

warning: 'overloadable' attribute directive ignored [-Wattributes]
[build]    11 | Vec3 multiply(Vec3 a, double b) __attribute__((overloadable));
[build]       | ^~~~
error: conflicting types for 'multiply'
[build]    11 | Vec2 multiply(Vec2 a, double b);
[build]       |      ^~~~~~~~

【问题讨论】:

  • 如果你需要用 C++ 重载编写

标签: c avr-gcc


【解决方案1】:

GCC 不支持__attribute__((overloadable)),它是 Clang 的扩展。 C 没有函数重载,请参阅here 了解通过宏的解决方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-01
    • 2011-04-02
    • 2018-11-11
    • 1970-01-01
    • 2015-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多