LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-13-2005, 01:01 AM   #1
swatward
Member
 
Registered: Jan 2005
Distribution: slackware
Posts: 83

Rep: Reputation: 15
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?
 
Old 06-13-2005, 01:13 AM   #2
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
Question 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
 
Old 06-13-2005, 01:18 AM   #3
needforspeed
Member
 
Registered: Aug 2003
Distribution: Gentoo
Posts: 73

Rep: Reputation: 15
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.
 
Old 06-13-2005, 01:52 AM   #4
swatward
Member
 
Registered: Jan 2005
Distribution: slackware
Posts: 83

Original Poster
Rep: Reputation: 15
oh ok, thats simple enough, thanks a lot.
 
Old 06-13-2005, 02:49 AM   #5
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
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
 
Old 06-13-2005, 11:56 PM   #6
swatward
Member
 
Registered: Jan 2005
Distribution: slackware
Posts: 83

Original Poster
Rep: Reputation: 15
Thanks a lot for that, that makes a lot of sense now and thanks for your time in writing this.
 
Old 06-14-2005, 12:48 AM   #7
uman
Member
 
Registered: Sep 2004
Distribution: Gentoo
Posts: 134

Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux & Unix fosterjuan Solaris / OpenSolaris 8 11-29-2005 04:14 AM
Is all Unix & Linux system is made by C++? Lancelot1914 Programming 24 06-21-2005 04:36 PM
gawk & sort commands in unix fanatic_ravi Linux - Software 0 01-25-2005 04:10 AM
Why did you experienced users of Unix change to unix over Windows? Laptop2250 Linux - General 11 10-28-2003 11:51 AM
Windows or Lunix/Unix Vash Linux - Newbie 10 03-08-2001 03:40 PM


All times are GMT -5. The time now is 06:35 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration