Multiply defined linker error using inlined functions

后端 未结 5 613
萌比男神i
萌比男神i 2020-12-20 07:44

The linker is reporting multiply defined errors for an inline function.

I have the following code in a header file:

struct Port_Pin
{
    volatile ui         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-20 08:38

    inline is just a suggestion, not a command. However, in general compilers are smart enough to do the right thing ( and Green Hills has a good reputation in so far as optimizations go ).

    Make the function 'static inline', which will prevent the compiler from making the symbol exportable. That should fix your multiple definition link errors... the linker is complaining that the same function is exported from several source modules.

提交回复
热议问题