Error when compiling blocks code in Snow Leopard
Error when compiling blocks code in Snow Leopard
- Subject: Error when compiling blocks code in Snow Leopard
- From: Stéphane Letz <email@hidden>
- Date: Thu, 3 Sep 2009 11:21:04 +0200
Hi,
We are experimenting with blocks in Snow Leopard and have the
following error when compiling C++ code:
class Foo {
void Bar()
{
dispatch_block_t b =
^{
for (int i = 0; i < 10; i++) {
}
};
}
};
test.cpp: In function ‘void __Bar_block_invoke_22(void*)’:
test.cpp:1206: error: ‘int Foo::i’ is not a static member of ‘struct
Foo’
test.cpp:1206: error: ‘i’ was not declared in this scope
test: *** [all] Error 1
The same blocks definition compiles as pure C :
void Bar()
{
dispatch_block_t b =
^{
for (int i = 0; i < 10; i++) {
}
};
}
Are they any limitation for use of local variables in blocks when
compiled in C++?
Thanks.
Stéphane Letz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden