Running a.out on Cygwin


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Running a.out on Cygwin
# 1  
Old 02-05-2004
Running a.out on Cygwin

I wrote and compiled a program on a unix machine using g++. Now I copied it over to the machine with the Unix emulator Cygwin. I tried to run it by entering "a.out" in the command prompt but was given:

"bash: a.out: command not found" (without the quotes)

Also worth mentioning is that i downloaded all of the cygwin packages and installed them.

I'm new to cygwin and i'm not sure what commands it uses to run a program, can anyone help?

Thanks,

- hito

Last edited by hito; 02-05-2004 at 03:23 PM..
# 2  
Old 02-05-2004
First try typing ./a.out

By default, the current directory is not in your path, so you must explicitly tell it a.out is in the current directory.

To see what directories are in your PATH (the directories where your shell will look for the program you specify on the command line) type echo $PATH.

Most likely, the current directory you're in is not included in that path. You must either add the directory you're in to the $PATH variable or precede your program with a period (which represents the current directory).
# 3  
Old 02-06-2004
Thanks for the help, apparently that was the problem at first. Then when I tried to run it, I got a bunch of errors. What I had to do was upload the source file and recompile it. Dunno why, seeing how both are using g++ to compile but that was the issue and it's working 100% perfectly right now.

Thanks again

- hito
# 4  
Old 02-27-2005
Question I have the same problem

Quote:
Originally Posted by oombera
First try typing ./a.out

By default, the current directory is not in your path, so you must explicitly tell it a.out is in the current directory.

Most likely, the current directory you're in is not included in that path. You must either add the directory you're in to the $PATH variable or precede your program with a period (which represents the current directory).
ok,
However, should I modify the path variable each time I move to another directory or create a new directory to compile and run programs in? There should be a short way to tell the shell that will not require me to modify the PATH each time I change/create directories. For example in school Unix machine this does not happen. I always create new directories and compile and run new programs and I never need to modify the PATH. But when I switch to cygwin the shell does not recognise the executable in a new directory...
# 5  
Old 02-27-2005
You could put "." in your PATH, but that's not a good idea....
What's wrong with having '.' in your $PATH ?
# 6  
Old 02-28-2005
Quote:
Originally Posted by Perderabo
You could put "." in your PATH, but that's not a good idea....
What's wrong with having '.' in your $PATH ?
this was the exact information I was looking for, thanks.. It's been very helpful.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Running Powershell Script from Linux through Cygwin

Hello Experts, I am creating a run time powershell script on Linux machine and copying that powershell script to Windows machine. To connect to windows through "ssh", I am using Cygwin tool. To make the connection password less I copied my public in authorized_keys in windows Administrator... (5 Replies)
Discussion started by: shekhar_4_u
5 Replies

2. Programming

Running python script in cygwin

I have python installed here on windows: C:\Python27 and can run a script from the command line but would rather use cygwin. $ cd "C:\Users\cmccabe\Desktop\annovar" cmccabe@DTV-L2231M5J /cygdrive/c/Users/cmccabe/Desktop/annovar $ python run_batch_job.py Traceback (most recent call last):... (3 Replies)
Discussion started by: cmccabe
3 Replies

3. Shell Programming and Scripting

Running q-shell commands( on IBM-i Series) from cygwin terminal (on windows)

I have cygwin installed on windows server and when I do echo $SHELL the output is /bin/bash I have created a ssh tunnel from this windows server through cygwin to ibm -i series which is running Q-shell. I am trying to invoke a utility wsadmin (used for scripting) on ibm-i from the... (12 Replies)
Discussion started by: gaurav99
12 Replies

4. Shell Programming and Scripting

Running shell script in Cygwin terminal

I am new to shell scripting. I tried to run a simple shell script using Cygwin terminal in Win XP env. The script I have written is as follows - #!/bin/bash a=5 ] && echo "true" || echo "false" But when I execute the script, getting some confusing error. The error I am getting are - ... (3 Replies)
Discussion started by: linux_learner
3 Replies

5. Shell Programming and Scripting

opening new instance of cygwin from withing cygwin

I'm using cygwin on win7, What I would like to do is something like this: cygstart cygwin tail -f /foo/test.log | perl -pe 's/error/\e I know I can start a new instance using either of these: mintty -e ... cygstart tail ... But neither of those open in ANSI mode, so I can't do... (0 Replies)
Discussion started by: Validatorian
0 Replies

6. UNIX for Dummies Questions & Answers

cygwin - sh-3.2$ help!

i am completely new to unix and am trying to learn with cygwin. my problem is simple.... when i use the 'man' command, eg 'man cat' id do not know how to get out of the manual!!!? if i type '!' and Return, rather than having just the $ prompt, it has 'sh-3.2$' as a command prompt.... (1 Reply)
Discussion started by: bobby999
1 Replies

7. Linux

cygwin

I'm trying to run the make command in cygwin. The directory is d:\resiprocate-1.2.3\resip\dum\test. But the command outputs: cant open perl script "c:\Program": No such file or directory why??...check the attached JPEG file....plz help (10 Replies)
Discussion started by: m_well
10 Replies

8. UNIX for Dummies Questions & Answers

Cygwin X

I have managed a successful install of Cygwin (after a few tries), and like any sensible person am ignoring the console in favour of the xconsole. I have this set up how I want - tcsh, all hot-keys (including ^z for suspend) and et cetera, but find it awfully slow. Are there any good... (7 Replies)
Discussion started by: fulgura
7 Replies

9. UNIX for Advanced & Expert Users

How to prevent job1 from running while job2 is running..

Hi, Please I need your expert advise on how to prevent/lock from execution job1 while job2 is still running in Unix... THanks:) (3 Replies)
Discussion started by: tikang
3 Replies

10. UNIX for Dummies Questions & Answers

Cygwin

Hi , I have cygwin software on my machine. can i practice shell script on that software or not? thanks sam71 (0 Replies)
Discussion started by: sam71
0 Replies
Login or Register to Ask a Question