English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Can you create programs that works on all platforms ( mac , linux & windows) without making seperate versions for each platform

2007-04-21 05:10:24 · 9 answers · asked by Andreu 2 in Computers & Internet Programming & Design

Such as a web browser , that would look and operate the same on mac, windows , linux

2007-04-21 05:17:46 · update #1

9 answers

That's a good question, with a complex answer.

If you are talking about running programs on the same CPU type with different OS's then an executible that will work with any of these OS's can be generated if you write all of the function calls yourself and do not include any of the library functions.

If you are talking about running on any of these OS's with out regard to which CPU they run on, then a functioning program can be written if you choose a scripting language that is available for all of these OS's. There are different flavors and varieties of these incluing Perl, Java, etc but you need an interpreter for this scripting language on each of the machines you want it to run on. In a way, this is what is happening with HTML, XML etc in webpages when your browser does the interpreting for that language. The big trick is picking a scripting language that is fairly stable .... I like Perl .... but tastes vary.

Have fun!

2007-04-21 08:56:12 · answer #1 · answered by Daniel T 4 · 0 0

I use a Mac and I think it is great. Key things to note about the Mac: It is a steep learning curve coming from a windows based machine. It is a little bit more expensive than your windows machine. The programs you list will not work natively on the mac. The Mac does allow you to install windows on it as well, so you can run the windows applications. There is a version of microsoft office (word, excel etc...) for the Mac. Good tip: I would recommend going into your local apple store and having a look at a 21" iMac or a 15" MacBook pro (later is a laptop, former a desktop). I don't know a lot about Linux. I love my Mac (some would say a little too much) and I would recommend it to anyone. Have you thought about upgrading your pc hardware tona faster machine and boosting the operating system to windows 7? Might be a little more cost effective. Hope this helps!

2016-05-20 03:18:52 · answer #2 · answered by ? 3 · 0 0

Yes,. but it would need to be recompiled for each platform that you want to use. This is how linux uses it. It runs a script called configure that checks the specifics of the current OS and generates the makefile accordingly. You must write it in c++ following ansi / POSIX specs. You cannot use platform specific calls and if you are doing a gui, then it would be necessary to call you windowing system specific calls. Windows API calls are not the same as QT / GTK

It is not possible to just copy and run an executable file from one system to the other without running it on some sort of emulator

2007-04-21 06:08:40 · answer #3 · answered by Anonymous · 0 0

As long as you don't use any operating system specific functions then yes you can. For example here's some C++ code:

int main() {
return 0;
}

This will compile on any OS.

But if I add this line:
#include

now I have a problem because timer.h is linux-specific. With C or C++ or other languages that get compiled into executables you will still run into a lot of problems using different compilers and whatnot but as long as your code is portable it can be done. Java is the easiest to write cross-platform in because it doesn't get compiled into a program.

2007-04-21 05:20:45 · answer #4 · answered by sfpiano 4 · 0 0

Yes and no - depending on the question you are asking. You should be able to write one set of source code that can be compiled and run on many platforms (but likely not all). Java is specifically designed for this as Java is compiled to a VM - Virtual machine, that is (more or less) operationally the same no matter what kind of computer (i.e. physical machine) it is running on.

However my experience with Java is not "write once run anywhere", it is "write once, debug everywhere". Still, you are only writing once.

If you want to end up with executable code that you can drop onto any computer and have it run, that is a bit tougher (Here again Java is designed for that, but results are mixed)

2007-04-21 05:25:49 · answer #5 · answered by jehen 7 · 0 0

Not really. Programs are written for a target CPU that will understand a particular instruction set. that way, the code is optimised for the that CPU. (ie. intel vs. older moterola CPU's)

You may (in some cases) only have to write a program once; but it will have to be compiled (turned into machine intructions) for each seperate target system it will run on.

2007-04-21 05:23:55 · answer #6 · answered by partsbucket 3 · 0 0

There are several ways to do this.

I think the one I like most, is for simple applications to be programmed as webpages (Web base Applications).

Or you could always use Java, Python, or other high level languages that are compatible on most platforms.

2007-04-21 05:15:53 · answer #7 · answered by Dany O 2 · 0 0

C++
works on all platforms.

2007-04-21 05:14:14 · answer #8 · answered by tattie_herbert 6 · 0 0

yes you can ,
http://searchstorage.techtarget.com/tip/1,289483,sid5_gci1082698,00.html

2007-04-21 05:14:48 · answer #9 · answered by Anonymous · 0 0

fedest.com, questions and answers