2

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.

Monolo
  • 18,205
  • 17
  • 69
  • 103
diatche
  • 99
  • 5
  • This is some C++ lambda extension? –  Sep 15 '11 at 08:10
  • 1
    @pst: No it's a C/Objective-C extension. You are correct, however, that it is an implementation of lambda expressions. – JeremyP Sep 15 '11 at 08:15
  • 3
    Could you provide a minimal test case that reproduces the problem and include the build log that yields the error in your system? –  Sep 17 '11 at 14:57

0 Answers0