碳类可可框架
我正在为 Leopard OS 编写上下文菜单插件并引用 示例CMPPlugIn。它工作正常。现在我想从这个插件调用 cocoa 函数,但是当我将 cocoa 框架添加到我的项目中并包含到源文件中时,我收到 10874 等错误。
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:126:0 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:126: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:127:0 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:127: error: expected ')' before '*' token
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:129:0 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:129: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
编辑:
当我按照 Michael Dautermann 的建议将源代码文件扩展名从 .c 更改为 .mm 时 ,我遇到了 5 个错误:
/Users/path/SampleCMPlugIn.mm:826:0 /Users/path/SampleCMPlugIn.mm:826: error: invalid conversion from 'const void*' to 'const __CFUUID*'
/Users/path/SampleCMPlugIn.mm:1228:0 /Users/path/SampleCMPlugIn.mm:1228: error: jump to label 'SampleSubMenu_Create_Complete_fail'
/Users/path/SampleCMPlugIn.mm:1140:0 /Users/path/SampleCMPlugIn.mm:1140: error: from here
/Users/path/SampleCMPlugIn.mm:1143:0 /Users/path/SampleCMPlugIn.mm:1143: error: crosses initialization of 'int disableMainMenu'
/Users/path/SampleCMPlugIn.mm:1142:0 /Users/path/SampleCMPlugIn.mm:1142: error: crosses initialization of 'int count'
有人可以帮我吗?
I am writing Contextual Menu Plugins for Leopard OS and referring SampleCMPlugIn. its working fine. Now i want to call cocoa function from this plugin but when i am adding cocoa framework into my project and including into source file i am getting 10874 errors like.
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:126:0 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:126: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:127:0 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:127: error: expected ')' before '*' token
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:129:0 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:129: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
EDIT:
when i change my source code file extension from .c to .mm as suggested by Michael Dautermann , i got 5 errors:
/Users/path/SampleCMPlugIn.mm:826:0 /Users/path/SampleCMPlugIn.mm:826: error: invalid conversion from 'const void*' to 'const __CFUUID*'
/Users/path/SampleCMPlugIn.mm:1228:0 /Users/path/SampleCMPlugIn.mm:1228: error: jump to label 'SampleSubMenu_Create_Complete_fail'
/Users/path/SampleCMPlugIn.mm:1140:0 /Users/path/SampleCMPlugIn.mm:1140: error: from here
/Users/path/SampleCMPlugIn.mm:1143:0 /Users/path/SampleCMPlugIn.mm:1143: error: crosses initialization of 'int disableMainMenu'
/Users/path/SampleCMPlugIn.mm:1142:0 /Users/path/SampleCMPlugIn.mm:1142: error: crosses initialization of 'int count'
can anyone please help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然。查看打开旧版 时出现的黄色框您提到的 SampleCMPlugin 页面:
Carbon 已被弃用,更重要的是,您正在编写的代码可能与 64 位操作系统不兼容(在这种情况下,Finder 不会加载它)。
一个不错的选择是使用服务菜单。
我还刚刚在 Google 上搜索了这个名为 Abracode Shortcuts 的产品的广告,该产品似乎是免费的事物。
Sure. Check out the yellow box that appears when you open that legacy SampleCMPlugin page that you mentioned:
Carbon is deprecated and more importantly, the code you're writing is likely to not be compatible with 64-bit OS'es (in which case it won't get loaded by the Finder).
A good alternative would be to use Services menus.
I also just Googled up this ad for a product called Abracode Shortcuts which appears to be a free thing.