将C ++代码从Windows移植到Mac

时间:2021-10-26 05:22:23

I'm a long time Windows developer, and it looks like I'm going to be involved in porting a Windows app to the Mac.

我是Windows开发人员的长期工作,看起来我将参与将Windows应用程序移植到Mac上。

We've decided to use Flex/Air for the gui for both sides, which looks really slick BTW.

我们决定使用Flex / Air作为两侧的gui,看起来非常光滑BTW。

My Windows application has a C++ DLL that controls network adapters (wired and wireless). This is written using the standard library and Boost, so most of it should work cross platform.

我的Windows应用程序有一个C ++ DLL,可以控制网络适配器(有线和无线)。这是使用标准库和Boost编写的,因此大多数应该跨平台工作。

On the Mac, what IDE/complier do most folks use if they want to write C++? Also, can someone provide a pointer to whatever APIs the Mac has that can control WiFi adapters (associate, scan, disconnect, etc)?

在Mac上,如果想要编写C ++,大多数人都会使用哪种IDE /编译器?此外,有人可以提供指向Mac所具有的可以控制WiFi适配器(关联,扫描,断开连接等)的任何API的指针吗?

6 个解决方案

#1


8  

Xcode is the IDE for Mac OS X, you can download the latest version by joining the Apple Developer Connection with a free Online membership.

Xcode是Mac OS X的IDE,您可以通过加入Apple Developer Connection以及免费的在线会员资格来下载最新版本。

I don't believe there are any supported APIs for controlling wireless networking adaptors. The closest thing would be the System Configuration framework, but I don't know if it will let you do everything you want.

我不相信有任何支持的API用于控制无线网络适配器。最接近的是系统配置框架,但我不知道它是否会让你做你想做的一切。

Also, I would strongly recommend against trying to use Flex/Air for your application's user experience. It may look slick to you on Windows as a Windows developer, but when it comes to providing a full Macintosh user experience such technologies aren't always a great choice.

此外,我强烈建议不要尝试使用Flex / Air来满足应用程序的用户体验。作为Windows开发人员,它在Windows上看起来很光滑,但是当提供完整的Macintosh用户体验时,这些技术并不总是一个很好的选择。

For one example, I think Air applications don't support the full range of Mac OS X text editing keystrokes. While not all Mac users will use all keystrokes, for those people used to them trying to type in a text field that doesn't handle (say) control-A and control-E to go to the beginning and end of field is like swimming through syrup.

举个例子,我认为Air应用程序不支持全系列的Mac OS X文本编辑按键。虽然并非所有Mac用户都会使用所有按键,但对于那些习惯他们的人来说,他们试图键入一个文本字段而不能处理(比方说)控制-A和控制-E来到字段的开头和结尾就像游泳一样通过糖浆。

For a new application that needs to be cross-platform, I'd strongly consider building the core logic in C++ while using Cocoa on the Mac and WPF on Windows to get the best user experience on each platform. Both Mac OS X and Windows have modern native user experience technologies that their respective users are getting used to, and also have good ways for C++ code to interoperate with these technologies.

对于需要跨平台的新应用程序,我强烈考虑在C ++中构建核心逻辑,同时在Mac上使用Cocoa,在Windows上使用WPF,以在每个平台上获得最佳用户体验。 Mac OS X和Windows都具有各自用户习惯的现代本机用户体验技术,并且还具有使C ++代码与这些技术互操作的良好方式。

#2


3  

The de-facto OS X IDE and compiler is Xcode. It comes with every Mac, you just install it from the OS X install CD.

事实上的OS X IDE和编译器是Xcode。它随每台Mac一起提供,您只需从OS X安装CD安装即可。

Apple's developer site is the place to get more information on OS X APIs

Apple的开发者站点是获取有关OS X API的更多信息的地方

#3


2  

by the way for the uninformed, it's "Xcode" not "xCode". Sorry for being pedantic :/

对于不知情的人来说,它的“Xcode”不是“xCode”。抱歉迂腐:/

#4


1  

Xcode and a custom GCC I believe...

Xcode和定制GCC我相信......

#5


0  

xcode is the hotness, as people have already pointed out.

正如人们已经指出的那样,xcode是热门。

Having maintained a windows/mac codebase in the past, take a look at MVC.

在过去维护过windows / mac代码库,请看一下MVC。

So long as you keep the background logic distinct from the UI and from the platform-specific stuff (like file handling, networks, drawing to the screen, etc). That way, when you want to go to Linux in the future, you just have to write those platform specific components.

只要你保持背景逻辑与UI和平台特定的东西(如文件处理,网络,绘图到屏幕等)不同。这样,当您希望将来使用Linux时,您只需编写这些特定于平台的组件。

As for mac networking, are you on the level of connecting and so forth? Why not just let the OS handle that, and then you just see what connections are available? Why bother with whether or not the connection is wired or wireless? Because the OS has a lot of those tools already built in and users are used to making sure that the connection is there to do work, it seems odd to have an extra program to want to manipulate the network.

至于mac网络,你是否处于连接等级?为什么不让操作系统处理它,然后你只看到可用的连接?为什么要连接是有线还是无线?因为操作系统已经内置了很多这些工具,并且用户习惯于确保连接可以正常工作,所以有一个额外的程序想要操作网络似乎很奇怪。

#6


0  

Xcode is used a lot, as far as I know the combination editor (e.g. Textmate), command line gcc is in fairly heavy use too. (that's what I do on OS X)

Xcode被大量使用,据我所知组合编辑器(例如Textmate),命令行gcc也被大量使用。 (这就是我在OS X上所做的)

For all API needs head to Apple's developer site e.g. the networking API's

对于所有API需求,请访问Apple的开发者网站,例如网络API

#1


8  

Xcode is the IDE for Mac OS X, you can download the latest version by joining the Apple Developer Connection with a free Online membership.

Xcode是Mac OS X的IDE,您可以通过加入Apple Developer Connection以及免费的在线会员资格来下载最新版本。

I don't believe there are any supported APIs for controlling wireless networking adaptors. The closest thing would be the System Configuration framework, but I don't know if it will let you do everything you want.

我不相信有任何支持的API用于控制无线网络适配器。最接近的是系统配置框架,但我不知道它是否会让你做你想做的一切。

Also, I would strongly recommend against trying to use Flex/Air for your application's user experience. It may look slick to you on Windows as a Windows developer, but when it comes to providing a full Macintosh user experience such technologies aren't always a great choice.

此外,我强烈建议不要尝试使用Flex / Air来满足应用程序的用户体验。作为Windows开发人员,它在Windows上看起来很光滑,但是当提供完整的Macintosh用户体验时,这些技术并不总是一个很好的选择。

For one example, I think Air applications don't support the full range of Mac OS X text editing keystrokes. While not all Mac users will use all keystrokes, for those people used to them trying to type in a text field that doesn't handle (say) control-A and control-E to go to the beginning and end of field is like swimming through syrup.

举个例子,我认为Air应用程序不支持全系列的Mac OS X文本编辑按键。虽然并非所有Mac用户都会使用所有按键,但对于那些习惯他们的人来说,他们试图键入一个文本字段而不能处理(比方说)控制-A和控制-E来到字段的开头和结尾就像游泳一样通过糖浆。

For a new application that needs to be cross-platform, I'd strongly consider building the core logic in C++ while using Cocoa on the Mac and WPF on Windows to get the best user experience on each platform. Both Mac OS X and Windows have modern native user experience technologies that their respective users are getting used to, and also have good ways for C++ code to interoperate with these technologies.

对于需要跨平台的新应用程序,我强烈考虑在C ++中构建核心逻辑,同时在Mac上使用Cocoa,在Windows上使用WPF,以在每个平台上获得最佳用户体验。 Mac OS X和Windows都具有各自用户习惯的现代本机用户体验技术,并且还具有使C ++代码与这些技术互操作的良好方式。

#2


3  

The de-facto OS X IDE and compiler is Xcode. It comes with every Mac, you just install it from the OS X install CD.

事实上的OS X IDE和编译器是Xcode。它随每台Mac一起提供,您只需从OS X安装CD安装即可。

Apple's developer site is the place to get more information on OS X APIs

Apple的开发者站点是获取有关OS X API的更多信息的地方

#3


2  

by the way for the uninformed, it's "Xcode" not "xCode". Sorry for being pedantic :/

对于不知情的人来说,它的“Xcode”不是“xCode”。抱歉迂腐:/

#4


1  

Xcode and a custom GCC I believe...

Xcode和定制GCC我相信......

#5


0  

xcode is the hotness, as people have already pointed out.

正如人们已经指出的那样,xcode是热门。

Having maintained a windows/mac codebase in the past, take a look at MVC.

在过去维护过windows / mac代码库,请看一下MVC。

So long as you keep the background logic distinct from the UI and from the platform-specific stuff (like file handling, networks, drawing to the screen, etc). That way, when you want to go to Linux in the future, you just have to write those platform specific components.

只要你保持背景逻辑与UI和平台特定的东西(如文件处理,网络,绘图到屏幕等)不同。这样,当您希望将来使用Linux时,您只需编写这些特定于平台的组件。

As for mac networking, are you on the level of connecting and so forth? Why not just let the OS handle that, and then you just see what connections are available? Why bother with whether or not the connection is wired or wireless? Because the OS has a lot of those tools already built in and users are used to making sure that the connection is there to do work, it seems odd to have an extra program to want to manipulate the network.

至于mac网络,你是否处于连接等级?为什么不让操作系统处理它,然后你只看到可用的连接?为什么要连接是有线还是无线?因为操作系统已经内置了很多这些工具,并且用户习惯于确保连接可以正常工作,所以有一个额外的程序想要操作网络似乎很奇怪。

#6


0  

Xcode is used a lot, as far as I know the combination editor (e.g. Textmate), command line gcc is in fairly heavy use too. (that's what I do on OS X)

Xcode被大量使用,据我所知组合编辑器(例如Textmate),命令行gcc也被大量使用。 (这就是我在OS X上所做的)

For all API needs head to Apple's developer site e.g. the networking API's

对于所有API需求,请访问Apple的开发者网站,例如网络API