简体   繁体   English

碳级可可框架

[英]cocoa framework in carbon class

I am writing Contextual Menu Plugins for Leopard OS and referring SampleCMPlugIn . 我正在为Leopard OS编写上下文菜单插件,并引用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. 现在我想从此插件调用可可函数,但是当我将可可框架添加到我的项目中并包括到源文件中时,我会收到类似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

EDIT: 编辑:

when i change my source code file extension from .c to .mm as suggested by Michael Dautermann , i got 5 errors: 当我按照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'

can anyone please help me out? 有人可以帮我吗?

Sure. 当然。 Check out the yellow box that appears when you open that legacy SampleCMPlugin page that you mentioned: 选中打开您提到的旧版SampleCMPlugin页面时出现的黄色框:

Important: The information in this document is obsolete and should not be used for new development . 重要提示:本文档中的信息已过时, 不应用于新的开发 Links to downloads and other resources may no longer be valid. 下载链接和其他资源可能不再有效。

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). Carbon已弃用,更重要的是,您正在编写的代码可能与64位操作系统不兼容(在这种情况下,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. 我也刚刚在Google 广告中搜索了一款名为Abracode Shortcuts的产品,该产品似乎是免费的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM