LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Windows C++ & Unix C++ (https://www.linuxquestions.org/questions/programming-9/windows-c-and-unix-c-332958/)

swatward 06-13-2005 01:01 AM

Windows C++ & Unix C++
 
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?

Mega Man X 06-13-2005 01:13 AM

Re: Windows C++ & Unix C++
 
Quote:

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:

http://en.wikipedia.org/wiki/C_Plus_Plus

needforspeed 06-13-2005 01:18 AM

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.

swatward 06-13-2005 01:52 AM

oh ok, thats simple enough, thanks a lot.

ta0kira 06-13-2005 02:49 AM

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/
ta0kira

swatward 06-13-2005 11:56 PM

Thanks a lot for that, that makes a lot of sense now and thanks for your time in writing this.

uman 06-14-2005 12:48 AM

The actual core C++ language is the same, but the libraries used to do things, like GUI development and graphics, are often (but not always) completely different.


All times are GMT -5. The time now is 01:02 AM.