Sunday, October 9, 2011

How to compile C/C++ programs under Linux (Absolute basics)

You have probably heard a lot about Linux and how you can do some real good programming under Linux. But right now you cant even get the simplest of Hello World programs to compile.
Here's how you do it -using gcc compiler

Once you have written and saved your C program using any editor return to the prompt. An ls command should display your C program. It should have the .c extension. Now at the prompt type the following

$ gcc -o firstprogram firstprogram.c

If your file is named firstprogram.c then type '-o firstprogram' as the parameter to gcc. This is basically your suggested name for the executable file that gcc would create. In case you typed something like the following

$ gcc firstprogram.c

You would be having a a.out in the same directory as the source C file. This is the default name of the executable that gcc creates. This would create problems when you compile many programs in one directory. So you override this with the -o option followed by the name of the executable

$ gcc -o hello secondprogram.c

Would create an executable by the name hello for your source code named secondprogram.c

Running the executable that you created is as simple as typing the following at the prompt.


$ ./firstprogram
OR
$ ./hello

Or whatever you named your executable.

This is the absolute basics of compiling C programs under Linux. Watch out for the articles that shall explain multiple file program compilation using make and other such tools.

Wednesday, May 11, 2011

Discuzz Virtual Pascal

This is nice IF you're coming from Turbo Pascal for DOS or you need to support OS/2, but as a general development environment, it's barely comparable to the version of Delphi from 9 years ago. In other words, if you're not stuck with a bunch of ancient TP code/skills or an app which must run on OS/2, this is a poor tool for Win32/Linux programming.

VPC 's fast, generates tight code, is almost 100% Borland compatible, is more powerful, and is free...
This is a must for DOS 32 developers who want to upgrade their Turbo Pascal 7.1 or their Borland Pascal 7.01 to the latest compatible versions.

From betanew
http://fileforum.betanews.com/detail/Virtual-Pascal/969940252/1

Friday, May 6, 2011

How to code a compiler?

Read here
Download pdf version
It has fifteen-part series, written from 1988 to 1995, is a non-technical introduction to compiler construction.

Read more
http://tratt.net/laurie/tech_articles/articles/how_difficult_is_it_to_write_a_compiler