重新定义“struct __block_literal_1”在 Obj-C 中
我已经解决这个问题有一段时间了,它真的让我发疯。每当我声明一个块时,我都会在使用 LLVM GCC 4.2 进行编译的 Xcode 4.1 中收到编译错误:
Redefinition of 'struct __block_literal_1'
即使从文档中复制粘贴的块示例也会引发错误:
int multiplier = 7;
int (^myBlock)(int) = ^(int num) {
return num * multiplier;
};
我已经多次尝试寻找此错误的解决方案,但无济于事。任何帮助将不胜感激。
更新:
我知道我发帖已经有一段时间了,但我迟早需要解决这个问题。我认为这与使用静态库有关。当将带有块的静态库添加到项目中时,会引发错误。将很快发布更多详细信息。
I've been working around this problem for a while now and it's really driving me insane. Whenever I declare a block, I get a compile error in Xcode 4.1 compiling with LLVM GCC 4.2:
Redefinition of 'struct __block_literal_1'
Even examples of blocks copy-pasted from the documentation throw the error:
int multiplier = 7;
int (^myBlock)(int) = ^(int num) {
return num * multiplier;
};
I've had several attempts to find a solution to this error to no avail. Any help would be appreciated.
Update:
I know it's been a while since I posted, but I will need to tackle this problem sooner or later. I think this has something to do with using static libraries. When a static library with blocks are added to a project, the error is thrown. Will post more details soon.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论