*BSD News Article 93988


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.ececs.uc.edu!news.kei.com!newsfeed.internetmci.com!feed1.news.erols.com!howland.erols.net!news.mathworks.com!uunet!in1.uu.net!128.138.243.15!csnews!boulder!rintintin.Colorado.EDU!fcrary
From: fcrary@rintintin.Colorado.EDU (Frank Crary)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Help with a.out
Date: 20 Apr 1997 15:37:01 GMT
Organization: University of Colorado, Boulder
Lines: 31
Message-ID: <5jdd6t$ndu@lace.colorado.edu>
References: <3355973C.429F@charlotte.infi.net>
NNTP-Posting-Host: rintintin.colorado.edu
NNTP-Posting-User: fcrary
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:39397


In article <3355973C.429F@charlotte.infi.net>,
drdan  <mdan@charlotte.infi.net> wrote:
>I am trying to write small programs in C++. I have been compiling with
>g++ and it gives me a file a.out I assume this is a executable. 
>Although, when I type a.out I get an error message that says that
>command a.out is not found.  I must be forgetting to do somthing simple,
>please help me.

I hit the same problem. Unix looks for executables in the directories
defined by the $PATH environment variable, and for some reason the
current directory is not part of the default $PATH in FreeBSD (or
at least not as of 2.1.5). You can fix that by editing your .cshrc file.
Originally, mine had a line reading

set path = (~/bin /bin /usr/{bin,games} /usr/local/bin /usr/X11R6/bin /sbin /u
sr/sbin )

by changing that to

set path = (. ~/bin /bin /usr/{bin,games} /usr/local/bin /usr/X11R6/bin /sbin /u
sr/sbin )

(with a . added), the machine looks for executables in all the normal 
directories _and_ whatever directory I happen to be in at the moment.
You could also use the full path, rather than changing your .cshrc, but
that's a pain. In the process of debugging something, I really don't
want to be typing out, "/usr/home/fcrary/Orbital/a.out" dozens of
times.

                                                               Frank Crary
                                                               CU Boulder