Link to home
Start Free TrialLog in
Avatar of DrWarezz
DrWarezz

asked on

Multi-OS applications.

Hi all,
Firstly, sorry for the lack of points, 20 is all I've got! :o(
Okay, basically, for future reference, I need to know this:
how to make a C++ program run on different OSs.
e.g.
If I say, use Dev-C++ to compile an .exe. Well, will this .exe run on, say LINUX, or UNIX, etc..
Or, is it required that I use a third-party software of some kind to compile it into something else, that will be compatible to other OSs.
Note: I'm not a PRO-grammer, I'm still kind of new to OOPLs, so be nice with the jargon. :o) HeHe.

Thanks very much in advance,
Regards,

[R.d]
Avatar of wayside
wayside

That exact .exe is unlikely to run directly on a machine with a different OS, they all work differently so you need to compile the program on a machine running that OS.

Plus, there are many different kinds of hardware, each with their own instruction set; they can't run code aimed at another processor.

There are programs/hardware that will let you emulate one kind of OS/hardware on another, for example to run a Windows PC program on a Sun.
You have a few choices however.  

Recomplie the code under another complier that supports the other OS and still uses C.  i.e. Linux or Mac (varients of Unix).

Convert the code to be Java, Java run on all machines.  

Use Wine on Linux, Wine runs win apps in Linux.

Take the logic of the code and rewrite in RealBasic,  works in ALL OS's.  Programing time in BASIC is usaualy only a fraction of the time needed for programming in C.

Buy IBM-PC machines (physpophically  speaking Windows machines).  See the big picture, a customer is paying you for something your time is very valuable, $400 for a windows machine is well worth it sometimes.  I hope that you are successful with your programming, keep your eye out and tell people what you do.  You might find some cash along the way.  You might want to learn Visual Basic and MS Access.

-JP
java would be a better choice for cross platform compatibility.
Recompiling is pretty much the only way to have A Different version for another OS.

Recompiling the codes in another compiler can be tricky and watch out for minor differences in how Compiler works in different OS. It is expected some codes may need to be addressed differently if the OS is under a very different platform such as Handheld PDA and Desktop.

The best approach is to TRY:
1. Get two compilers for different OSes, and compile two separate .EXE.
2. Runt them to see any problems.
3. Convert the Codes to Java

Good Luck and godspeed.

Avatar of DrWarezz

ASKER

Hi all,
thanks very much for all the input - much appreciated.
Okay, I can do quite a bit of Java - but I find C++ soo much easier! I once read that java is the easier and more compatible version of C++. More compatible, yea.. But easier? Not from my point of view. So, that's really why, for now, I want to stick with C++.
Okay then. I think I would like to just get another compiler that supports other OSs. The main OS that I'm bothered about is UNIX - as my dads work need some software, I can do it - but they run UNIX, and I'm on Windows.
So, can someone quite clearly, talk me through the process of compiling an .exe to run on UNIX.?
Possibly suggest some software...?
--
Thanks VERY much all!
[R.d]
Any ideas?
thanks.
[R.d]
Try this site, it has many of the key compilers available for C++ including some tips. Some aremore useful than others.

Checkout Intel - Linux compiler on the list...

http://www.thefreecountry.com/compilers/cpp.shtml

Do watchout compliance to ANSI C/C++ standard when coding and compiling.

Hope that helps.
ASKER CERTIFIED SOLUTION
Avatar of Jenn3
Jenn3
Flag of Åland Islands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Jenn3, that's brilliant!
lol - yay, free!
:o) thanks VERY much!
[R.d]
(Thanks to everyone else also though!)
[R.d]