LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-18-2005, 05:20 PM   #1
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 241

Rep: Reputation: 31
a.out does not run


I have a simple "hello world" program in my user directory that I compiled by typing "g++ hello.cc." It produces an output file "a.out" that is also in my user directory. When I type "a.out" at the command prompt I an error message that says something similar to "bash: command not found." Does anyone know why I can't run a.out?
 
Old 08-18-2005, 05:34 PM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
A program will be run if you provide the exact pathname to it or if it's in a directory listed in the $PATH environment variable.

Try running the program as
Code:
./a.out
 
Old 08-22-2005, 08:57 AM   #3
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 241

Original Poster
Rep: Reputation: 31
What is the reason for typing './' in './a.out' ?
 
Old 08-22-2005, 10:15 AM   #4
saman007uk
Member
 
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 364

Rep: Reputation: 33
To show that the a.out file is in the current folder.
 
Old 08-22-2005, 02:41 PM   #5
stefanlasiewski
Member
 
Registered: Aug 2003
Location: Berkeley, California, USA
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92

Rep: Reputation: 16
When the Linux shell executes commands, it first looks to see if you specified an explicit path name. If the shell doesn't see a path name, it searches in the PATH environment variable (Look in /usr/local/bin, then /usr/bin, etc).

This is a very unintuitive piece of Unix, and confuses many people. Some people get around this by setting PATH to include the current working directory, '.':

export PATH=".:$PATH"
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot get NVIDIA-Linux-x86_64-1.0-6629-pkg2.run to run properly doctorwebbox Linux - Hardware 0 02-06-2005 06:18 AM
Not able to run audio Cds (not MP3) and run VCDS.. satish427 Linux - Newbie 4 09-24-2004 11:27 PM
Trying to run photoshop in wine. Install, but wont run. bruno buys Linux - Software 14 07-15-2004 04:30 PM
will delphi run on winex ? (i cant run kylix3 :(( ) hunter_one Linux - Software 0 10-19-2003 08:41 AM
Java applets run fine in Konqueror, but won't run in MS IE. OAnimal Linux - Software 7 12-04-2002 06:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 11:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration