简体   繁体   English

在Linux上运行MFC程序

[英]Run MFC program on Linux

I have a rather large MFC based program. 我有一个相当大的基于MFC的程序。 I have been tasked to get it running on Linux. 我的任务是让它在Linux上运行。 I have explained that this will require a re-write of the program either into straight C++ with STL (more work), or into Qt/C++ (less work). 我已经解释过这需要将程序重写为带有STL的直接C ++(更多工作),或者重写Qt / C ++(更少的工作)。 I am now told that I need to write wrappers to get every MFC class working in Linux and use preprocessor directives to only compile what is needed in either Linux or Windows. 我现在被告知我需要编写包装器以使每个MFC类在Linux中工作并使用预处理器指令仅编译Linux或Windows中所需的内容。 I explained that we are having a communication disconnect and that I believed this to be more work than rewriting the entire project from scratch (which I would not have to do to convert to Qt). 我解释说我们正在断开通信,而且我认为这比从头开始重写整个项目要多得多(我不需要转换为Qt)。

Any good arguments out there to help explain this issue? 有什么好的论据可以帮助解释这个问题吗? Am I wrong? 我错了吗?

If you don't want a full rewrite, you could try compiling against Winelib . 如果您不想完全重写,可以尝试编译Winelib Most things should just work and then since you have the source, you can work around the parts that don't. 大多数事情应该只是工作,然后因为你有源,你可以解决没有的部分。

The obvious solution is to run the code unchanged and un-recompiled on WINE. 显而易见的解决方案是在WINE上运行代码不变并且不重新编译。

A simple (kludgy) solution is to run an entire Windows VM on the Linux system, and deploy the application as a virtual hard-drive, but that will require a Windows license and is little different than simply connecting a Windows system to a Linux network. 一个简单(kludgy)的解决方案是在Linux系统上运行整个Windows VM,并将该应用程序部署为虚拟硬盘驱动器,但这需要Windows许可证,与将Windows系统简单地连接到Linux网络几乎没有什么不同。

If you must re-write, wxWidgets would be more familiar to an MFC developer than Qt perhaps. 如果你必须重写,那么对于MFC开发人员而言,wxWidgets可能比Qt更熟悉。

Here is an article on porting MFC apps to Linux that considers the use GTK+, Qt and wxWidgets. 这是一篇关于将MFC应用程序移植到Linux 的文章 ,它考虑使用GTK +,Qt和wxWidgets。 It also discusses why you should consider and try WINE before any of those options. 它还讨论了为什么你应该考虑并在任何这些选项之前尝试WINE。 The author talks about future articles on the subject, but appears to have written nothing further since 2004. 作者讨论了有关该主题的未来文章,但自2004年以来似乎没有进一步的写作。

The sources for MFC and ATL total to over 500000 lines of code, and most of the functionality of this code is actually provided by the Windows API itself. MFC和ATL的源代码总共超过500000行代码,此代码的大部分功能实际上是由Windows API本身提供的。 How many lines of code can you write in a day? 一天能写多少行代码? The scale of what you are being asked to do is simply impractical, even if you're only implementing a small subset of MFC. 即使您只实现了一小部分MFC,您要求做的事情的规模也是不切实际的。

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

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