newbie of c++ in linux
Oscar Fuentes
ofv@wanadoo.es
Fri Jun 28 18:47:00 GMT 2002
faisal gillani <fasi_74@yahoo.com> writes:
> 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");
> }
#include <stdio.h>
int main() {
printf("hello wordl\n");
}
<stdudio.h> contains a typo
<conio.h> does not exists on Linux. It is not a C or C++ Standard
header file. Furthermore, I doubt that it is necessary at all for
building that program with your Windows compiler.
And now build the program with
g++ myprogram.cpp -o myprogram
Note that you should use 'g++' instead of 'gcc' for building C++
apps. g++ automatically uses some libraries that are often required
for building C++ apps.
It will generate an executable called "myprogram". If "-o myprogram"
were absent it will generate an executable named 'a.out'. It's a valid
executable, despite it's name. Execute your program with
./myprogram
note the ./ It's necessary because, out of the box, most shells does
not looks for executables on the current directory, so you need to say
"execute the 'myprogram' executable which is located on the current
directory"
>
>
> 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 ?
Hope this helps.
Now execute the command
info g++
and enjoy the fine manual :-)
--
Oscar
More information about the Gcc-help
mailing list