开发者

Run MFC program on Linux

开发者 https://www.devze.com 2023-03-26 11:39 出处:网络
I have a rather large MFC based program.I have been tasked to get it running on Linux.I have explained that this will require a re-write of the program either into straight C++ with STL (more work), o

I have a rather large MFC based program. I have been tasked to get it running on 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). 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. I explained that we are having a communication disconnect and that I believed this to be more work than rewriting the entire project fro开发者_StackOverflow社区m scratch (which I would not have to do to convert to 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. 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.

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.

If you must re-write, wxWidgets would be more familiar to an MFC developer than Qt perhaps.

Here is an article on porting MFC apps to Linux that considers the use GTK+, Qt and wxWidgets. It also discusses why you should consider and try WINE before any of those options. The author talks about future articles on the subject, but appears to have written nothing further since 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. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号