Aswin Rajamannar wrote:
> But wait. I do have a compiler. I want it as an information. In some books,
> i've read that a c program can be written in any text editor, but should be
> saved with the extension .cpp. I have turbo C++ but that doesn't matter
> however. I jus wanna know if compilation and execution is possible through
> text editor. (I'm a student. I teach C++ to my classmates in their own
> laptops. So instead of searching the directory of IDE and opening it, i
> think it's time-saving to do on text editor, as i do not deal with big
> programs)

Actually, using Turbo C++ _DOES_ matter.  You and your classmates should 
NOT be using it.  It is non-ANSI Standard, extremely outdated, no one in 
the industry uses it, and there are infinitely better alternatives out 
there - of which many are free.  Every last C/C++ user group out there 
will simply tell you to upgrade your compiler.

Anyway, to answer the question, each compiler is different.  Most modern 
compilers separate the compiling and linking stages into two separate 
executables but usually the compiler offers a combined compile and link 
in one stage sort of option on the command-line.  You will have to read 
the documentation for each compiler used to know how to compile software 
from the command-line.

You might want to consider putting the compiler and linker on a USB 
thumbdrive?  Then you won't have to rely on the target machine having a 
compiler in the first place.  In general, you need everything in the 
/lib and /include directories plus the obvious executables from the /bin 
directory (directory names for compiler components are fairly 
consistent).  You may also need to copy over a few DLLs (depending on 
the compiler).  A batch file should set up a working environment and 
then run the compiler.  Keep all paths relative since you don't know 
what drive letter is going to be given to the USB drive by the OS.

Just a thought.  But you do need to find a different compiler.  Turbo 
C++ is incredibly outdated.


Finding a new compiler is quite easy. c-prog maintains a massive 'Links' 
section on its website. One of those sections is entitled "Compilers 
(free)":

http://tech.groups.yahoo.com/group/c-prog/links/Compilers_000986587674/

There are hundreds of free compilers to choose from. However, there are 
just a handful that are popular, well supported, ANSI Standard, and free:

Microsoft Visual C++ 2008 Express
wxDev-C++
MinGW
gcc/g++

C++ compilers are usually backwards-compatible and will also compile C 
code.  Of the compilers listed, Microsoft Visual C++ (including Express) 
currently has the best debugger on the planet - period.  If you are 
learning C/C++, the ability to step through code line by line and see 
what is wrong is invaluable.  Other compiler suites have debuggers but 
aren't nearly as good.


There are two commercial (non-free) compilers worth mentioning as well. 
Compilers that are not free have to provide a LOT of added value to 
justify their cost.

Microsoft Visual Studio 2008 Professional - In general, if you plan on 
doing Microsoft Windows-specific GUI development (e.g. involving COM, 
ATL, MFC, Office, Vista, etc.), this is the development suite to have. 
Many developers enhance the environment with third-party tools such as 
Visual Assist X.  Also, a number of popular open source projects (e.g. 
TortoiseSVN) will completely build only under the latest version of 
Visual Studio Professional.  Be prepared to pay Microsoft prices though.

Comeau C++ - This is the most ANSI Standards compliant compiler in 
existence. Period. And it is available for virtually every modern 
platform. They have an online code compiler so you can see if code that 
doesn't compile under your compiler but should will compile under theirs.


-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to