How do I get blocks/grand central dispatch working in Snow Leopard? It appears that the library is not installed by def开发者_高级运维ault: when I try to do #include <dispatch/dispatch.h>
, I get a library not found error.
I have tried making the source I found here: http://libdispatch.macosforge.org/ but it generated an error (internal.h:99:27: error: Block_private.h: No such file or directory
+ others), but I am not even sure if that is the correct source to use. Any pointers on how to get this to work are appreciated.
Check that the project is set to use the 10.6 SDK.
You shouldn't have to compile anything special to get dispatch.h
. In fact, library not found implies that it's a linking error, not anything to do with dispatch.h
itself.
For the record, dispatch.h
is located at: /Developer/SDKs/MacOSX10.6.sdk/usr/include/dispatch/dispatch.h
Can we see the exact error message? Something doesn't make sense here.
You have to change the current SDK for your project, because Grand Central Dispatch is only working on Snow Leopard.
Go to Project > Edit Project Settings > General
At the bottom of the window you have to change the
Base SDK for All Configurations: to Mac OS X 10.6.
精彩评论