Inline function “undefined symbols” error

前端 未结 3 1637
天涯浪人
天涯浪人 2020-12-05 23:48

I want to write an inline function, but I get an error. How can I fix it?

Error information:

Undefined symbo         


        
相关标签:
3条回答
  • 2020-12-06 00:15

    I think XYInRect() needs to be known prior to being used. Move the function definition to some place in the file before you call it.

    0 讨论(0)
  • 2020-12-06 00:21

    Clang defaults to C99 and not GNU sematics, which means a raw inline is different from both static inline and extern inline.

    In particular, a raw inline means that the function still has external linkage, but the inline definition does not provide the external one (you'd need extern inline for that).

    What this means is that you need an additional extern definition in a different translation unit or linking will fail. However, you're probably looking for static inline.

    0 讨论(0)
  • 2020-12-06 00:28

    Also would suggest using CGRectContainsPoint

    0 讨论(0)
提交回复
热议问题