DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   Compiling Programs (http://www.daniweb.com/forums/thread1728.html)

cscgal Nov 16th, 2003 12:03 pm
Compiling Programs
 
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.



tsh Jul 26th, 2004 1:09 pm
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!

cscgal Jul 26th, 2004 8:36 pm
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.

marvis4life Jul 31st, 2004 12:12 pm
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?

marvis4life Jul 31st, 2004 12:17 pm
Re: Compiling Programs
 
does borland free compiler have any short-coming too like other free c++ comilers?
is it in it's fullest version?

paawam Aug 4th, 2004 12:38 pm
Re: Compiling Programs
 
where will i get C compiler free download

paawam Aug 4th, 2004 12:39 pm
Re: Compiling Programs
 
i need tutorials for c language so where i will get them

FireNet Aug 29th, 2004 2:40 am
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/

marvis4life Aug 29th, 2004 4:06 pm
Re: Compiling Programs
 
FireNet,
thanks, i will get the ver3 now. but can u pls tell me more about the IDE stuff?

marvis4life Aug 30th, 2004 5:33 pm
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.


All times are GMT -4. The time now is 5:47 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC