是否有一个库/框架允许使用 C++ 编写 Carbon 应用程序?课程?

发布于 2024-09-09 00:16:59 字数 1536 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

弥繁 2024-09-16 00:16:59

曾经有一个名为 PowerPlant 的 C++ 框架,与 Metrowerks 捆绑在一起。现在它已开源:Open PowerPlant。啊,那些日子......

还有一个叫做 MacApp,最初由苹果自己维护。但它在向 OS X 过渡期间被放弃了。一些铁杆支持者似乎维护着一个分支,显然是:ClubMacApp

您可以使用 Qt,它是一个值得尊敬的跨平台 C++ GUI 库。它是在 Carbon 之上构建的,但现在是在 Cocoa 之上。

wxWidgets 也是一个跨平台的 C++ GUI 库。它再次从碳基向可可基过渡。

Carbon 本身,从 OS X 10.2 Tiger 开始,有一个名为 HIToolbox 的对象系统,通过 C 接口公开,请参见 Apple 指南,但它是为了解旧版经典 Toolbox 的人编写的。围绕它有一个 C++ 框架,包含在 Apple 的示例代码中,名为 HI框架

也就是说,强烈建议学习 Objective-C 并使用 Cocoa。原因是多方面的:

  1. Apple 实际上停止了向 Carbon 框架的 GUI 部分添加功能。它不适用于 64 位等。

  2. 如果您已经了解 C++,并且具备指针等方面的应用知识,那么学习 Objective-C 就非常容易。这实际上需要一天的时间,仅此而已。有关 Objective-C 和 C++ 的比较,请参阅这份精心总结的文档作者:P.夏特列。对于那些已经了解 C++ 的人来说,这真的非常非常好。

  3. 无论如何,真正困难的部分是习惯框架本身,无论是 Carbon 还是 Cocoa,它们在很大程度上独立于语言。不幸的是,网上有关 Carbon 的资源非常匮乏,而且也相当过时。 (我唯一知道的是 CarbonDev 和令人尊敬的 Macintosh C Carbon。)Apple 在过渡到 OS X 后对 Carbon 做了许多不错的补充,但除了它们之外,关于它们的信息很少Apple 自己的简洁文档。只需比较 SO 上标记为 carboncocoa 的问题数量即可。关于 Cocoa,您可以获得更多信息。

There was once a C++ framework called PowerPlant, bundled with Metrowerks. It's now open sourced: Open PowerPlant. Ah, those were the days...

There was also something called MacApp, originally maintained by Apple itself. But it was abandoned during its transition to OS X. Some hardcore supporters seem to maintain a fork, apparently: ClubMacApp.

You can use Qt which is a respectable cross-platform C++ GUI library. It was built on top of Carbon, but it's now on top of Cocoa.

wxWidgets is also a cross platform C++ GUI library. Again it is in transition from Carbon-based to Cocoa-based.

Carbon itself, since OS X 10.2 Tiger, has an object system called HIToolbox, exposed by a C-interface, see Apple's guide, but it's written for people who knew the older, classic Toolbox. There's a C++ framework around it, included in Apple's sample codes, called HIFramework.

That said, it is strongly recommended to learn Objective-C and use Cocoa. The reasons are manifold:

  1. Apple effectively stopped adding features to the GUI portion of Carbon framework. It's not available in 64 bit, etc.

  2. If you already know C++ and thus have a working knowledge of pointers etc, it's very easy to learn Objective-C. It takes literally a day and that's it. For a comparison of Objective-C and C++, see this nicely summarized document by P. Chatelier. It is really, really good for those who know C++ already.

  3. In any case the really hard part is getting used to the framework itself, be it Carbon or Cocoa, which is largely independent of the language. Unfortunately the resource on Carbon is very meagre on 'Net, and they are also rather dated. (The only things I know are CarbonDev and the venerable Macintosh C Carbon.) Apple made many nice additions to Carbon after they transitioned to OS X, but there is very few info on them except Apple's own terse documentation. Just compare the number of questions tagged carbon and cocoa on SO. You have so much more available about Cocoa.

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