碳类可可框架

发布于 2024-12-25 04:57:29 字数 1951 浏览 0 评论 0原文

我正在为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪化雨蝶 2025-01-01 04:57:29

当然。查看打开旧版 时出现的黄色框您提到的 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:

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).

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文