ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Im having sortof a hard time understanding this, is the only diffrence between the two is that one is compiled and run and the other is run uncompiled? Im probably way off but its been bugging me.
What is the diffrence?
Originally posted by swatward Im having sortof a hard time understanding this, is the only diffrence between the two is that one is compiled and run and the other is run uncompiled? Im probably way off but its been bugging me.
What is the diffrence?
I've no idea what you mean. C++ is C++, regardless it's platform. It's a programming language. It's up to the compiler to create then applications/executables and there is where things can change. Read this:
C++ is always compiled, doesn't matter what the OS is. The executable must be compiled for each OS though, for example, compiling the program on a linux machine to run it on a Linux machine, and using a windows machine to compile the program to run on Windows.
The difference is the binary interface with the operating system. Both C and C++ are generic in that they do not favor a particular OS by definition; they define how the language works, and the processing behavior that a binary resulting from an OS-specific compile must have. The compilers used for each OS are designed around this, however they use different assembly languages and generate different binary files, but technically should operate the same if they are written in pure C/C++. The major difference comes when you decide to use OS-specific features, such as DLLs or shared libraries. These require the support of the kernel, and therefore require different incompatible sources. Also, the GUIs for X-windows and Windows are not compatible, therefore making their implementations non-portable. When the code is compiled, it becomes a binary file that has instructions that specifically work for the kernel being used; binaries for Windows don't make sense to Linux/Unix, and likewise. Some reasons a lot of Linux/Unix software is distributed as source code are 1) the open-source initiative, 2) "all" POSIX-compatible systems have a compiler, and the kernels/system setups used are so diverse that there is no reasonable way to standardize the binaries, so why not create a binary specific to your system? 3) having non-standardized binaries allows for a diverse spectrum of compatible systems. The reasons you don't get sources with Windows/DOS software is because 1) MS is closed-source, 2) Windows is Windows is Windows, 3) DOS is DOS is DOS. If you are interested in what a compiler does, look at this: http://www.angelfire.com/dragon/lets...ials/compiler/