943,862 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 16367
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Nov 16th, 2003
0

Compiling Programs

Expand Post »
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.
Similar Threads
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is online now Online
13,645 posts
since Feb 2002
Jul 26th, 2004
0

Re: Compiling Programs

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!
tsh
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tsh is offline Offline
1 posts
since Jul 2004
Jul 26th, 2004
0

Re: Compiling Programs

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.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is online now Online
13,645 posts
since Feb 2002
Jul 31st, 2004
0

Re: Compiling Programs

Quote 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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
marvis4life is offline Offline
5 posts
since Jul 2004
Jul 31st, 2004
0

Re: Compiling Programs

does borland free compiler have any short-coming too like other free c++ comilers?
is it in it's fullest version?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
marvis4life is offline Offline
5 posts
since Jul 2004
Aug 4th, 2004
0

Re: Compiling Programs

where will i get C compiler free download
Reputation Points: 10
Solved Threads: 0
Newbie Poster
paawam is offline Offline
3 posts
since Aug 2004
Aug 4th, 2004
0

Re: Compiling Programs

i need tutorials for c language so where i will get them
Reputation Points: 10
Solved Threads: 0
Newbie Poster
paawam is offline Offline
3 posts
since Aug 2004
Aug 29th, 2004
0

Re: Compiling Programs

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/
Reputation Points: 108
Solved Threads: 7
Posting Whiz in Training
FireNet is offline Offline
256 posts
since May 2004
Aug 29th, 2004
0

Re: Compiling Programs

FireNet,
thanks, i will get the ver3 now. but can u pls tell me more about the IDE stuff?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
marvis4life is offline Offline
5 posts
since Jul 2004
Aug 30th, 2004
0

Re: Compiling Programs

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
marvis4life is offline Offline
5 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: need Homework help
Next Thread in C++ Forum Timeline: C++ char array parsing-Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC