Linker error calling C-Function from Objective-C++

前端 未结 2 1754
离开以前
离开以前 2020-12-29 04:47

I\'ve got a weird linker issue. I have code that looks like so:

    double given_amount = self.modelController.levelCompleteRewardAmount;
    swrve_currency_         


        
2条回答
  •  遥遥无期
    2020-12-29 05:42

    You may need to surround the function prototype with:

    #if defined __cplusplus
    extern "C" {
    #endif
    
    void swrve_currency_given (...whatever goes here...);
    
    #if defined __cplusplus
    };
    #endif
    

    That tells the compiler that it's a C function and not a C++ function.

提交回复
热议问题