Compiling Programs

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2002
Posts: 12,035
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Compiling Programs

 
0
  #1
Nov 16th, 2003
Creating Executables
Of course, the software on your computer isn't all a bunch of code in a high level language, at least not in the form you receive it in. Before you can run any programs which are written in C++ or Java, they must be compiled. Compiling is the process by which a computer reads the code which you have written and interprets it. Usually, this is followed by the creation of an executable file. Executables are files which can be run by a user, like programs.

Compiling Your Code
To compile a program, you need to make use of a compiler. Each programming language available requires its own compiler to process the code. For example, one needs one of the many C++ compilers to process C++ code, similarly to how one needs a Java compiler to process Java code.

There are numerous compilers available, each one specific to a particular operating system and language. While free ones are available, they often prohibit the use of legally selling the software you create with them. It goes without saying that each compiler may have its own little quirks. For example, while trying to compile one of your programs, you may receive a simple warning when using one compiler. While using a different compiler, however, you may generate a programaming error, prohibiting your code from being compiled at all.

One of the most well known compilers for Windows machines is Microsoft Visual Studio 6.0, consisting of Visual C++ 6.0 and Visual J++ 6.0 (which can be purchased stand-alone as well). This program allows you to write software for Windows 9x/Me, NT, 2000, and XP.

Yet another very good compiler for Windows is made by Borland ... Borland C++ Builder and Borland JBuilder. They also offer free stripped-down C++ and Java compilers through their website.

Using A UNIX Compiler
Of course, the UNIX / Linux operating systems also make use of their own compilers. Compiling C++ on a UNIX box often involves the use of gcc, one of the original UNIX-based C++ compilers. This handy lil terminal-based program is commonly distributed with the operating system itself. To compile, simply type the following in a terminal:

g++ file.C -o executable_name



Of course, your new executable file can then be run by typing ./executable_name. Note that file.C represents the original name of the C or C++ source code, and executable_name is the name of the location where you wish to put the new file to be created. If the file already exists, it will be overwritten automatically.


Last edited by cscgal; Aug 26th, 2004 at 3:00 pm.
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 1
Reputation: tsh is an unknown quantity at this point 
Solved Threads: 0
tsh tsh is offline Offline
Newbie Poster

Re: Compiling Programs

 
0
  #2
Jul 26th, 2004
I would like to start learning C++ (on an iMac G4) - Do I need to download C++ compiler? If yes, could you advise where I can download it?

Thanks!
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,035
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Compiling Programs

 
0
  #3
Jul 26th, 2004
If you are using OS X, the gcc compiler comes with the BSD subsystem. It's an optional component to install during OS X setup.
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 5
Reputation: marvis4life is an unknown quantity at this point 
Solved Threads: 0
marvis4life's Avatar
marvis4life marvis4life is offline Offline
Newbie Poster

Re: Compiling Programs

 
0
  #4
Jul 31st, 2004
Originally Posted by cscgal

Creating Executables
Of course, the software on your computer isn't all a bunch of code in a high level language, at least not in the form you receive it in. Before you can run any programs which are written in C++ or Java, they must be compiled. Compiling is the process by which a computer reads the code which you have written and interprets it. Usually, this is followed by the creation of an executable file. Executables are files which can be run by a user, like programs.

Compiling Your Code
To compile a program, you need to make use of a compiler. Each programming language available requires its own compiler to process the code. For example, one needs one of the many C++ compilers to process C++ code, similarly to how one needs a Java compiler to process Java code.

There are numerous compilers available, each one specific to a particular operating system and language. While free ones are available, they often prohibit the use of legally selling the software you create with them. It goes without saying that each compiler may have its own little quirks. For example, while trying to compile one of your programs, you may receive a simple warning when using one compiler. While using a different compiler, however, you may generate a programaming error, prohibiting your code from being compiled at all.

One of the most well known compilers for Windows machines is Microsoft Visual Studio 6.0, consisting of Visual C++ 6.0 and Visual J++ 6.0 (which can be purchased stand-alone as well). This program allows you to write software for Windows 9x/Me, NT, 2000, and XP.

Yet another very good compiler for Windows is made by Borland ... Borland C++ Builder and Borland JBuilder. They also offer free stripped-down C++ and Java compilers through their website.

Using A UNIX Compiler
Of course, the UNIX / Linux operating systems also make use of their own compilers. Compiling C++ on a UNIX box often involves the use of gcc, one of the original UNIX-based C++ compilers. This handy lil terminal-based program is commonly distributed with the operating system itself. To compile, simply type the following in a terminal:
g++ file.C -o executable_name

Of course, your new executable file can then be run by typing ./executable_name. Note that file.C represents the original name of the C or C++ source code, and executable_name is the name of the location where you wish to put the new file to be created. If the file already exists, it will be overwritten automatically.
does borland free compiler have any short-coming too like other free c++ comilers?
is it in it's fullest version?
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 5
Reputation: marvis4life is an unknown quantity at this point 
Solved Threads: 0
marvis4life's Avatar
marvis4life marvis4life is offline Offline
Newbie Poster

Re: Compiling Programs

 
0
  #5
Jul 31st, 2004
does borland free compiler have any short-coming too like other free c++ comilers?
is it in it's fullest version?
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 3
Reputation: paawam is an unknown quantity at this point 
Solved Threads: 0
paawam paawam is offline Offline
Newbie Poster

Re: Compiling Programs

 
0
  #6
Aug 4th, 2004
where will i get C compiler free download
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 3
Reputation: paawam is an unknown quantity at this point 
Solved Threads: 0
paawam paawam is offline Offline
Newbie Poster

Re: Compiling Programs

 
0
  #7
Aug 4th, 2004
i need tutorials for c language so where i will get them
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 256
Reputation: FireNet will become famous soon enough FireNet will become famous soon enough 
Solved Threads: 6
FireNet's Avatar
FireNet FireNet is offline Offline
Posting Whiz in Training

Re: Compiling Programs

 
0
  #8
Aug 29th, 2004
Borland free C++ compiler i.e version 5.x does not come with and editor or and IDE.
But I heard they did release version 3.x compleately free along with the IDE.Go get that one if you can.

http://www.borland.com/
See what you can, remember what you need

Fourzon | Earn via Coding
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 5
Reputation: marvis4life is an unknown quantity at this point 
Solved Threads: 0
marvis4life's Avatar
marvis4life marvis4life is offline Offline
Newbie Poster

Re: Compiling Programs

 
0
  #9
Aug 29th, 2004
FireNet,
thanks, i will get the ver3 now. but can u pls tell me more about the IDE stuff?
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 5
Reputation: marvis4life is an unknown quantity at this point 
Solved Threads: 0
marvis4life's Avatar
marvis4life marvis4life is offline Offline
Newbie Poster

Re: Compiling Programs

 
0
  #10
Aug 30th, 2004
FireNet,
i've got it. but have not known how to use it. it's always giving the message:
Failed to locate protected mode loader (DPMILOAD.EXE).
can u put me thru. in using it?
thanks.
Living in an atmosphere of dominion....:)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC