This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: first program


that means you don't have current directory specified in
PATH environment variable.
try
$echo $PATH
if there is no '.' in there, it means you're not including current
directory, so you should type
$export PATH=.:$PATH
(in bash or zsh)
and you can go
$which hello
the result expected is './hello'
hope this help
In article <RZI_3.5545$h8.319495@nnrp2.ptd.net>,
  "Will Elmes" <welmes@ptd.net> wrote:
> nope,  absolutely nothing.  just goes back to the command prompt.
>
> but when i just tried "./hello" it worked.  any idea what the reason
is??
> thanks for the help.
>
> will elmes
>
> Lokesh Setia <lokeshs@sh.bel.alcatel.be> wrote in message
> xnhemdhea0v.fsf@sh.bel.alcatel.be">news:xnhemdhea0v.fsf@sh.bel.alcatel.be...
> >
> > >>>>> "Will" == Will Elmes <welmes@ptd.net> writes:
> >
> >     Will> this is my first attempt at compiling and running a
program
> >     Will> under linux.  this doesn't make sense but when i attempt
to
> >     Will> run it absolutely nothing happens.
> >
> >     Will> #include <iostream.h> int main(void) { cout << "hello!!";
}
> >
> >     Will> then to compile: $g++ -Wall -c hello.cpp
> >
> >     Will> then to link(i think i need to do this?>?): $g++ hello.o -
o
> >     Will> hello
> >
> >     Will> then to execute: $hello
> >
> >     Will> i get nothing.....any help for a newbie would be
> >     Will> appreciated.
> >
> > A random advice:
> >
> > Do you get nothing or do you get an error saying:
> > hello: command not found
> >
> > In case you get the error, try running ./hello instead of hello,
> > it helps sometimes :-)
> >
> > Regards,
> > Lokesh.
> >
> > --
> > When we come back, I'll drop a line. (The Doors)
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]