I work in a team of developers, one of us works specifically under Windows, and I work primarily in Mac OS X. We're wanting to develop C-based applications either in C++ or Objective-C however I'm not really knowledgeable in how to go about a cross-platform development project.
我在一个开发人员团队中工作,我们其中一人专门在Windows下工作,我主要在Mac OS X中工作。我们想要用C ++或Objective-C开发基于C的应用程序但是我不是很了解如何进行跨平台开发项目。
Is it viable to work in C++ using Mac OS X? Obviously they're geared towards Objective-C but is there just as much support for C++. What about cross-platform development in these languages? I'd use something like boost and some kind of UI library.
使用Mac OS X在C ++中工作是否可行?显然他们面向Objective-C,但是对C ++的支持也是如此。那些语言的跨平台开发呢?我会使用像boost和某种UI库这样的东西。
Has anyone got any experience in developing for multiple platforms yet allow applications to run natively without the need for a VM?
有没有人有过开发多平台的经验,但是允许应用程序在不需要VM的情况下本地运行?
EDIT: There's a lot of answers I want to mark as correct now. It seems like Qt is the way to go and develop it in C++. Chances are this will be for *nix, OS X and Windows so that would be the best option for us personally. If I can avoid writing Objective-C so the team sticks to C++ then all the better. If I have to write the GUI in Objective-C and mix and match then that's not too much bother either.
编辑:现在我想要标记为正确的答案很多。似乎Qt是用C ++开发它的方法。这可能适用于* nix,OS X和Windows,因此这对我们个人来说是最好的选择。如果我可以避免编写Objective-C,那么团队会坚持使用C ++,那就更好了。如果我必须在Objective-C中编写GUI并进行混合和匹配,那么这也不会太麻烦。
5 个解决方案
#1
9
You could look at Qt. I've used it successfully on Windows, Linux and Mac OSX projects.
你可以看看Qt。我在Windows,Linux和Mac OSX项目上成功使用它。
#2
11
I work for a software company that produces software for Mac OS X and Windows using C++, MFC, and Objective-C.
我在一家软件公司工作,该公司使用C ++,MFC和Objective-C为Mac OS X和Windows生成软件。
Yes, it is definitely possible.
是的,这绝对是可能的。
You probably will be best served if you develop the "core" of the application in C++. In a MVC application, the C++ part would be the model, and possibly the controllers. For the code that interfaces to the GUI and other OS-specific interfaces, you should use the native APIs: Objective-C on Mac OS X and C# on Windows XP.
如果你用C ++开发应用程序的“核心”,你可能会得到最好的服务。在MVC应用程序中,C ++部分将是模型,可能是控制器。对于与GUI和其他特定于操作系统的接口接口的代码,您应该使用本机API:Mac OS X上的Objective-C和Windows XP上的C#。
The good thing about the Mac is that you can compile C++ and Objective-C together. You can even have Objective-C++ where C++ and Objective-C are compiled in the same compilation unit. Unfortunately you cannot do this with C# (there is something called Managed C++ which is a different beast).
关于Mac的好处是你可以一起编译C ++和Objective-C。您甚至可以使用Objective-C ++,其中C ++和Objective-C在同一编译单元中编译。不幸的是你不能用C#做这件事(有一种叫做托管C ++的东西,它是一种不同的野兽)。
I would avoid cross-platform frameworks such as Qt and wxWidgets. They both allow you to develop cross-platform applications, but the look and feel of such applications is sub-par. I have more familiarity with wxWidgets though, its design is heavily geared towards the Windows MFC paradigm of application design.
我会避免使用Qt和wxWidgets等跨平台框架。它们都允许您开发跨平台应用程序,但这些应用程序的外观和感觉是低于标准的。我对wxWidgets更熟悉,它的设计非常适合Windows MFC应用程序设计范例。
Edit May 14, 2009, 9:44 AM EST: If Qt now allows true look and feel of the native platform, it could be a good option. I haven't looked at the latest offering so you may want to look at that framework before designing your own. That decision should be made after examining the results of the applications and how comfortable you are with the design paradigms that Qt requires.
编辑2009年5月14日,美国东部时间上午9:44:如果Qt现在允许原生平台的真实外观,它可能是一个不错的选择。我没有看过最新的产品,所以你可能想在设计自己的框架之前先查看一下这个框架。在检查应用程序的结果以及您对Qt所需的设计范例的满意度之后,应该做出这个决定。
#3
4
what I use, is have a common library written in C or C++ with all the core functionality of your application.
我使用的是一个用C或C ++编写的公共库,它具有应用程序的所有核心功能。
Let's say you are building a solitaire game. So you will have core classes in a pure C++ (mostly platform independent) library.
假设您正在构建单人纸牌游戏。因此,您将在纯C ++(主要是平台无关)库中拥有核心类。
- CoreSolitaire
Then, you will have separate UI projects, one for each platform you want to deploy your solitaire on:
然后,您将拥有单独的UI项目,每个平台都针对您要部署单人纸牌的平台:
- iSolitaire (Objective-C, MultiTouch Cocoa Based for iPhoneOS)
- MacSolitaire (Objective-C, Cocoa Based for Mac OS X)
- WinSolitaire (C++, Win32 or C# Based for Windows plaforms)
- GSolitaire (C++, GNome/GTK based for linux/unix)
iSolitaire(Objective-C,基于iPhoneOS的MultiTouch Cocoa)
MacSolitaire(Objective-C,基于Mac OS X的Cocoa)
WinSolitaire(适用于Windows平台的C ++,Win32或C#)
GSolitaire(C ++,基于linux / unix的GNome / GTK)
It's more work, but, in my opinion, the resulting product is definitely better than one you could get by using a platform independent widget set like QT or wxWidgets.
这是更多的工作,但是,在我看来,最终产品肯定比使用像QT或wxWidgets这样的平*立小部件集合获得的产品更好。
Having said this, if you are going to deploy your product internally in a company where you have full control of the deployment environment, and you don't care that much about how the resulting product will behave on different platforms, you could definitely use a common API for everything (QT, wxWidgets, or any other you might encounter).
话虽如此,如果您要在一个完全控制部署环境的公司内部部署产品,并且您不太关心最终产品在不同平台上的表现,那么您肯定可以使用一切的通用API(QT,wxWidgets或您可能遇到的任何其他)。
#4
1
Is it viable to work in C++ using Mac OS X? Obviously they're geared towards Objective-C but is there just as much support for C++.
使用Mac OS X在C ++中工作是否可行?显然他们面向Objective-C,但是对C ++的支持也是如此。
Yes, there is.
就在这里。
You can do pretty much anything you want with C++ in OS X --anything that you could do with C++ on Linux, for example. There is support for the gcc's C++ compiler, c++ libraries, et all. Xcode provides support for working with C++.
你可以在OS X中用C ++做任何你想做的事 - 例如你可以用Linux上的C ++做的事情。支持gcc的C ++编译器,c ++库等等。 Xcode为使用C ++提供支持。
You can even mix c++ with objective-C with Objective-C++ (Note, however, that this is not portable for GUI work).
您甚至可以将c ++与Objective-C与Objective-C ++混合使用(但请注意,这对于GUI工作来说不可移植)。
What about cross-platform development in these languages? I'd use something like boost and some kind of UI library.
那些语言的跨平台开发呢?我会使用像boost和某种UI库这样的东西。
I believe that your best bet is QT.
我相信你最好的选择是QT。
It is a stable C++ library that is cross-platform (Windows, OSX, Linux and more), has been around for over a decade, is well supported, with many commercial apps written in it (Skype, Adobe Photoshop Album) and a ton of open source stuff written with it (the KDE desktop for starters). Besides GUI stuff it provides a whole lot more (container classes, xml, database connectivity, etc).
它是一个稳定的C ++库,跨平台(Windows,OSX,Linux等),已经存在了十多年,得到很好的支持,其中编写了许多商业应用程序(Skype,Adobe Photoshop Album)和吨用它写的开源东西(KDE桌面为初学者)。除了GUI之外,它还提供了更多(容器类,xml,数据库连接等)。
You can develop both Open Source and proprietary (closed source) apps for free with the latest QT, and the library was recently bought by NOKIA, a huge multinational, so it isn't going away any time soon.
您可以使用最新的QT免费开发开源和专有(闭源)应用程序,该库最近被大型跨国公司NOKIA收购,因此它不会很快消失。
Besides the library, QT also comes with an IDE and a Visual Forms Designer (all for free).
除了库,QT还附带一个IDE和一个Visual Forms Designer(全部免费)。
Other cross-platform GUI libraries for C++ also exist for OS X (wxWidgets, gtkmm, et al).
OS X还存在其他用于C ++的跨平台GUI库(wxWidgets,gtkmm等)。
#5
0
Has anyone got any experience in developing for multiple platforms yet allow applications to run natively without the need for a VM?
有没有人有过开发多平台的经验,但是允许应用程序在不需要VM的情况下本地运行?
Slightly. Make sure that you wrap around all the platform specific code. That way you're main application or library doesn't need to reference the platform specific code. That should make it alot easier when porting to another platform.
略。确保包装所有特定于平台的代码。这样你就是主应用程序或库不需要引用特定于平台的代码。这应该使移植到另一个平台时更容易。
#1
9
You could look at Qt. I've used it successfully on Windows, Linux and Mac OSX projects.
你可以看看Qt。我在Windows,Linux和Mac OSX项目上成功使用它。
#2
11
I work for a software company that produces software for Mac OS X and Windows using C++, MFC, and Objective-C.
我在一家软件公司工作,该公司使用C ++,MFC和Objective-C为Mac OS X和Windows生成软件。
Yes, it is definitely possible.
是的,这绝对是可能的。
You probably will be best served if you develop the "core" of the application in C++. In a MVC application, the C++ part would be the model, and possibly the controllers. For the code that interfaces to the GUI and other OS-specific interfaces, you should use the native APIs: Objective-C on Mac OS X and C# on Windows XP.
如果你用C ++开发应用程序的“核心”,你可能会得到最好的服务。在MVC应用程序中,C ++部分将是模型,可能是控制器。对于与GUI和其他特定于操作系统的接口接口的代码,您应该使用本机API:Mac OS X上的Objective-C和Windows XP上的C#。
The good thing about the Mac is that you can compile C++ and Objective-C together. You can even have Objective-C++ where C++ and Objective-C are compiled in the same compilation unit. Unfortunately you cannot do this with C# (there is something called Managed C++ which is a different beast).
关于Mac的好处是你可以一起编译C ++和Objective-C。您甚至可以使用Objective-C ++,其中C ++和Objective-C在同一编译单元中编译。不幸的是你不能用C#做这件事(有一种叫做托管C ++的东西,它是一种不同的野兽)。
I would avoid cross-platform frameworks such as Qt and wxWidgets. They both allow you to develop cross-platform applications, but the look and feel of such applications is sub-par. I have more familiarity with wxWidgets though, its design is heavily geared towards the Windows MFC paradigm of application design.
我会避免使用Qt和wxWidgets等跨平台框架。它们都允许您开发跨平台应用程序,但这些应用程序的外观和感觉是低于标准的。我对wxWidgets更熟悉,它的设计非常适合Windows MFC应用程序设计范例。
Edit May 14, 2009, 9:44 AM EST: If Qt now allows true look and feel of the native platform, it could be a good option. I haven't looked at the latest offering so you may want to look at that framework before designing your own. That decision should be made after examining the results of the applications and how comfortable you are with the design paradigms that Qt requires.
编辑2009年5月14日,美国东部时间上午9:44:如果Qt现在允许原生平台的真实外观,它可能是一个不错的选择。我没有看过最新的产品,所以你可能想在设计自己的框架之前先查看一下这个框架。在检查应用程序的结果以及您对Qt所需的设计范例的满意度之后,应该做出这个决定。
#3
4
what I use, is have a common library written in C or C++ with all the core functionality of your application.
我使用的是一个用C或C ++编写的公共库,它具有应用程序的所有核心功能。
Let's say you are building a solitaire game. So you will have core classes in a pure C++ (mostly platform independent) library.
假设您正在构建单人纸牌游戏。因此,您将在纯C ++(主要是平台无关)库中拥有核心类。
- CoreSolitaire
Then, you will have separate UI projects, one for each platform you want to deploy your solitaire on:
然后,您将拥有单独的UI项目,每个平台都针对您要部署单人纸牌的平台:
- iSolitaire (Objective-C, MultiTouch Cocoa Based for iPhoneOS)
- MacSolitaire (Objective-C, Cocoa Based for Mac OS X)
- WinSolitaire (C++, Win32 or C# Based for Windows plaforms)
- GSolitaire (C++, GNome/GTK based for linux/unix)
iSolitaire(Objective-C,基于iPhoneOS的MultiTouch Cocoa)
MacSolitaire(Objective-C,基于Mac OS X的Cocoa)
WinSolitaire(适用于Windows平台的C ++,Win32或C#)
GSolitaire(C ++,基于linux / unix的GNome / GTK)
It's more work, but, in my opinion, the resulting product is definitely better than one you could get by using a platform independent widget set like QT or wxWidgets.
这是更多的工作,但是,在我看来,最终产品肯定比使用像QT或wxWidgets这样的平*立小部件集合获得的产品更好。
Having said this, if you are going to deploy your product internally in a company where you have full control of the deployment environment, and you don't care that much about how the resulting product will behave on different platforms, you could definitely use a common API for everything (QT, wxWidgets, or any other you might encounter).
话虽如此,如果您要在一个完全控制部署环境的公司内部部署产品,并且您不太关心最终产品在不同平台上的表现,那么您肯定可以使用一切的通用API(QT,wxWidgets或您可能遇到的任何其他)。
#4
1
Is it viable to work in C++ using Mac OS X? Obviously they're geared towards Objective-C but is there just as much support for C++.
使用Mac OS X在C ++中工作是否可行?显然他们面向Objective-C,但是对C ++的支持也是如此。
Yes, there is.
就在这里。
You can do pretty much anything you want with C++ in OS X --anything that you could do with C++ on Linux, for example. There is support for the gcc's C++ compiler, c++ libraries, et all. Xcode provides support for working with C++.
你可以在OS X中用C ++做任何你想做的事 - 例如你可以用Linux上的C ++做的事情。支持gcc的C ++编译器,c ++库等等。 Xcode为使用C ++提供支持。
You can even mix c++ with objective-C with Objective-C++ (Note, however, that this is not portable for GUI work).
您甚至可以将c ++与Objective-C与Objective-C ++混合使用(但请注意,这对于GUI工作来说不可移植)。
What about cross-platform development in these languages? I'd use something like boost and some kind of UI library.
那些语言的跨平台开发呢?我会使用像boost和某种UI库这样的东西。
I believe that your best bet is QT.
我相信你最好的选择是QT。
It is a stable C++ library that is cross-platform (Windows, OSX, Linux and more), has been around for over a decade, is well supported, with many commercial apps written in it (Skype, Adobe Photoshop Album) and a ton of open source stuff written with it (the KDE desktop for starters). Besides GUI stuff it provides a whole lot more (container classes, xml, database connectivity, etc).
它是一个稳定的C ++库,跨平台(Windows,OSX,Linux等),已经存在了十多年,得到很好的支持,其中编写了许多商业应用程序(Skype,Adobe Photoshop Album)和吨用它写的开源东西(KDE桌面为初学者)。除了GUI之外,它还提供了更多(容器类,xml,数据库连接等)。
You can develop both Open Source and proprietary (closed source) apps for free with the latest QT, and the library was recently bought by NOKIA, a huge multinational, so it isn't going away any time soon.
您可以使用最新的QT免费开发开源和专有(闭源)应用程序,该库最近被大型跨国公司NOKIA收购,因此它不会很快消失。
Besides the library, QT also comes with an IDE and a Visual Forms Designer (all for free).
除了库,QT还附带一个IDE和一个Visual Forms Designer(全部免费)。
Other cross-platform GUI libraries for C++ also exist for OS X (wxWidgets, gtkmm, et al).
OS X还存在其他用于C ++的跨平台GUI库(wxWidgets,gtkmm等)。
#5
0
Has anyone got any experience in developing for multiple platforms yet allow applications to run natively without the need for a VM?
有没有人有过开发多平台的经验,但是允许应用程序在不需要VM的情况下本地运行?
Slightly. Make sure that you wrap around all the platform specific code. That way you're main application or library doesn't need to reference the platform specific code. That should make it alot easier when porting to another platform.
略。确保包装所有特定于平台的代码。这样你就是主应用程序或库不需要引用特定于平台的代码。这应该使移植到另一个平台时更容易。