TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:6686] Newbie using gcc



> > I need some help in getting started with gcc. I have a few simple C
> > and C++ programs I need compiled on my RedHat 6 system. Where can I
> > find some examples of compiling some source code into executable
> > programs?
> 
> $ gcc input.c -o output
> $ ./output
> Hello World in C!
> $ g++ input.cc -o output
> $ ./output
> Hello World in C++!
> 
> You (usually) need to add the './' to the command in order for it to run from
> the current directory -- that is because the current directory is  not in the
> PATH (as opposed to in DOS, where if you type in a command, it looks in the
> current directory before looking elsewhere..)

DOH! I cannot believe that that was all I had to do. What is the 
difference between 'ouput' and './output' if I am trying to run to 
program from the directory it resides in. In other words, if I am in 
the directory where the compiled program is when I try to run it, why 
would it need to be in my path??
 
> The 'man' command is your friend, learn it, know it, use it..

Actually it didn't help, neither did the gcc HOW-TO. You certainly 
did though. Thank-you for the reply. I imagine I need to do the same 
thing at the office under HP-UX.

Mike Glaser