[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Ot c++ programming in linux



On 29-Jun-2002 faisal gillani wrote:
> Well i am a newbie learning c++ these days we are
> being thaught on turbo c 3.0 but as like other things
> i want to work on c++ in linux .. so i installed gcc
> on my linux box but i dont have any idea how to
> install it for example i write a program as follows in
> turbo c
> 
>#include<studio.h>
>#include<conio.h>
> void main (void)
> {
> printf("hello world");
> }
> 
> 
> 
> how do i write the same program in gcc ?
> i have tried the same but it gives out error the
>#in... files not found 
> what can i do & how to compile this program ?
> 

(that is C, not C++, but I remember those classes supposedly teaching C++ ....)

conio.h is a dos specific header, there is no good UNIX/Linux equivalent.  In
the above example it can be left out.  Once you have removed that line the code
will compile.

gcc -Wall -W -pedantic hello.c -o hello

the above line enables all warnings and will help you write clean code.
'hello.c' is the name of the source file you create, it will be output as a
program called 'hello', that is what the -o is for.

A common problem new coders have is they create a file called 'test' this is a
bad name for a program because it has the possibility of being replaced by
/bin/test when you run it.

$ gcc test.c -o test
$ test
$
and nothing happens.  TO be sure run all your programs with a path

$ ./test # use the 'test' program in ./ (aka this directory)


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: