iphone error: expected '=', ',', ';', 'asm' or '__attribute__' before ' 'foo'

前端 未结 6 1516
忘掉有多难
忘掉有多难 2020-11-28 10:45

I\'m trying to port the speakhere example into another app and I\'m having issues. I copied all the files, and all the frameworks, but for some reason I get a bunch of comp

6条回答
  •  暖寄归人
    2020-11-28 11:21

    In my case, the .h and .m in question are built fine with regular target, and the App can run as well.

    However after the subset of the files are moved under a static library target, it gets this compile error when the static library is built.

    Was stuck for a while & tried the above mentioned techniques, unfortunately they didn't help in my case.

    Noted that this error happened only for the NSString*, for e.g.,

    • extern double const kTimeout; // fine
    • extern NSString* const kImageType; // compile error

    After the above analysis & little break, eventually the problem is resolved by adding the the following import to the .h - "Foundation/Foundation.h"

提交回复
热议问题