Can MFC application run on operating system other than windows? - mfc

I need to create a dialog based GUI using VC++/MFC. I am sure it will work with windows OS, but will it work on Linux/Unix or other OS other than windows?
Is QT an alternative good option?

An application written using MFC classes would most probably not work on Linux or Unix, sourcecode-wise. You would have to reimplement most of MFC using X Windows. Qt is a good alternative when the sourcecode has to be used on multiple platforms, e.g. Windows and Linux.
If you just want to run a compiled .exe on Linux, there's the Wine project on Linux that lets you run the application using a "translation layer" that runs on Linux.

No, MFC is for Windows development. I have some vague memory of there being a version of MFC for Solaris or something about 12-15 years ago, but I can't find any information about that now. There is however two other commercial solutions that are supposed to be useful for porting MFC apps to unix:
Mainsoft for UNIX and Linux
Bristol Wind/U (I don't know if this exists anymore though since Bristol was bought by HP a few years ago).
All in all though, if you need an app to run on both Windows and Unix/Linux I'd suggest looking at QT since that's what usually gets recommended for that.

Related

Can i create application in Windows for Linux platform?

I have around of 4 years experience in C#.Net programming and i am developing a client server application. The server application will be insalled on CentOS and client application will be installed in Windows OS. But, i don't have much knowledge about c++ programming on linux platform. So, my question is that can i create a console application in Windows OS and compile it for linux platform. it is not necessary that compile it on Windows. but, it should be executed in linux platform. I am new in linux programming.
Presently i am using TC++ editor. Can i use Visual Studio 2010 to build server application for linux platform?
if there are another approach then please suggest me.
Thanks.
You can develop the client in C# and the server in C++, if you prefer. Consider that unlike C#, there is no standard socket library yet, and you'll have to rely on either system calls or their higher level wrappers (like boost).
I've to tell you that Windows uses BSD sockets (its own version, with some modifications though), therefore with a few preprocessors checks, you can make your application portable.
In your case, I'd suggest you to go for boost.asio which will hide all low-level stuff for you. It's even cross-platform.
Maybe you can use VS as an editor ; Make sure that you do not include any windows specific libs; There is an option of using cygwin and doing a cross compilation. Check the links
How to cross compile from windows g++ cygwin to get linux executable file
I guess it will be more of a pain. Better use Virtual Box --> linuxMint/Ubuntu + Eclipse with C++ plugin or some other C++ editor...

How to use a windows .lib on linux using WINE

I have been using Qt (uses c++ code + Qt libraries) on the windows platform and am in the process of porting my project onto the Linux platform.
Using Qt this has been a very simple process and my project works on the Linux platform with barely any changes required.
However, we need to use a 3rd party windows compiled .lib with an associated header file. Clearly this file cannot work under Linux, but I have been reading posts that suggest I could use Wine to do this.
So in general my project will work as a normal Linux (Ubuntu) project, but I would like to include this .lib file using Wine. I have not been able to find a definitive answer "how to do this". I am not sure if you use Wine to translate the .lib into a .so file or if you have to statically link it in with some "Wine-like" convention...
Can anyone help point me in the right direction?
Thanks :)
AFAIK, you can't make hybrid applications with Wine (i.e. link C++ Linux executable with some Linux static libraries and Windows static libraries).
One of the solution I suggest is to encapsulate you Windows library in a Windows program that act as some network service, then you make your Linux application talk to your Windows library through the network.
However, it adds complexity to your software, requires you know how to do some network programing (however, these days it is quite easy to do) and is not suitable to every kind of library, especially if your library has some kind of GUI.
Have you tried compiling under Windows and running the entire program under Wine?
I'm not sure you can splice Wine and Linux programs.
I cannot imagine that a hybrid approach would work. In any case, running part of your program as a native application and the other part inside WINE will not give you much advantage over the complete program running in WINE. In either case, WINE is needed.
The main disadvantage of running the complete program in WINE is the look and feel of the GUI which might look a little alien to the system. However, using a proper setup for WINE will minimize the problem. And as a side note, most Linux users are used to different GUI concepts due to the different desktop environments available. Personally I have a lot of GNOME applications running in my KDE desktop.
I would personally try running your program in WINE. It makes development much easier. A circuit simulation tool that is quite famous with electrical engineers uses this approach. It is called LTSpice. While only Windows binaries are available, the developers test it with WINE to ensure that it runs on Linux. Admitted, it is a tool offered for free but the community accepts this approach.

Can you program a GUI in C++ that works on both Windows and Linux operating systems?

I have been learning C++ for a while now, and so far I love it. But I have been stuck at the console application level. I have built C# programs for a few years so I love having a GUI and not do everything via console.
Console programs when compiled will work on both windows and linux, which is great. When I was searching GUI C++ tutorials I could only find tutorials for windows specific GUI applications.
So my question is this, can you program a GUI in C++ that when compiled with run on both windows and linux? If this is not possible, can someone point me to a great place to learn windows and linux GUI?
I suggest you to use Qt by Nokia:
http://qt.nokia.com/products/
It is free, very powerful, very easy to use, and well designed. And there is also a Visual Studio Add-in available:
http://developer.qt.nokia.com/wiki/QtVSAddin
but you can use their own cross-platform IDE called Qt Creator as well.
You can use wxWidget library.
Yes, you need to use a cross platform GUI toolkit like WxWidgets
gtk and gtkmm http://www.gtkmm.org/en/
Indeed, using cross-platform GUI libraries (like Qt, Gtk, WxWidgets) help you to have the same source code working on Linux and Windows. I recommend Qt if coding in C++.
But there is no way to build an executable working on both systems (unless you use wine to emulate Windows on Linux, which I don't recommend in your case).

Is it possible to use Xcode for Linux Development?

My team is planning to start development on linux platform. Previously we have been developing C++ applications in Windows using MS Visual Studio. And recently, I fell in love with Mac OSX and use it as my personal development machine.
The question is once again: Is it possible to use Xcode for Linux Development?
The applications we are building are real-time applications, which do not require fancy looking GUIs or advanced user interaction, the focus is on the performance.
As long as you stick to cross-platform interfaces (glibc, POSIX, STL, etc.), sure. You might need a Linux machine to actually build the binaries for Linux though.
I think it is possible since both xcode and linux are using gcc and could use similar development toolkits, and both osx and linux are unix based, therefore you can debug and code on osx, but I think you still need to recompile your apps on deployment O/S ( so make sure you're using portable codes between osx and linux)

C++ development for Linux on Windows

I am trying to setup a development environment for Linux C++ application. Because I'm limited to my laptop (vista) which provides essential office applications, I want to program and access email, word at the same time.
I'd prefer a local Windows IDE. SSH to a company linux server and using VI doesn't seem productive to me. Even using some IDE installed on the linux server doesn't seem good to me, because I can't do the work at home.
So does Eclipse CDT + MinGW work for me, or is there any other choice?
Thanks.
ZXH
Why not install a Linux virtual machine on your laptop, in VMware or similar? That way you can test while you're developing too.
You can also try http://cygwin.com/
Is it a GUI app? And do you have to target Linux specifically? If not, Qt (http://trolltech.com/) may be something that you can use. It would allow you to more or less develop your whole application on Windows, and then spend a few hours on a linux machine getting the whole thing ported...
Qt is the best choice. I develop with tis tool for a long time. And you can develop with the same ide : QtCreator and the same framework : Qt on MacOS, Linux based or Windows plateform...
Moreover, specifically on Linux, Qt is well integrated with Kdevelop !
If you have Visual Studio, which I feel is an excellent IDE, you can try to set it up to use GCC/G++. I've done this before, back in the Visual Studio 6 days. As long as you aren't using any Windows-specific libraries and write portable C++, you can compile and test on Windows, then periodically ensure that the code also compiles properly for Linux.
Another approach, one that I actually prefer, is to host your source and make files on the Linux box, share the files through Samba, then use your Windows IDE/text editor to edit those files. Then, you can do the compiling through an SSH terminal. Sure, you'd lose the convenience of being able to compile through your IDE, but at least you wouldn't have to muck around getting the compiler set up on Windows.
If you have a linux server available to you, you could also use NX to log in graphically, and use a Linux IDE there like Code::Blocks, or shudder Eclipse. Of course, there's nothing unproductive about shelling in and using VIM. I find it's a good way to shake out the IDE-induced cobwebs every now and again. Happy coding however you end up doing so!
I use (and recommend) Netbeans for C/C++ Development together with Cygwin to develop POSIX applications on Windows that will run on Linux/Solaris later on.
It is pretty easy to setup as long as you stick to the stable version of Cygwin.
I was in a similar position 2-3 years ago and tried several approaches, but the only one that really worked wor me was vim+ssh (+gdb, make, svn, etc). But again, I use vim even for Windows development.
This slideshow (PDF) walks through how to set up a cross compiler from Windows to Linux.