This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

Re: Problems with Hello World.




Ajoy Victor wrote:

> Here is my hello world program:
>
> [~] $cat hello.c
> main () {
> printf ("Hello\n");
> }

Lovely :)

> I compile it:
>
> [~] $gcc hello.c -o hello

That would be correct :)

> I see it is there:
>
> [~] $dir
> hello.c    hello.exe  man.cfg    sh.exe

Yes, it is.

> I try to run it:
>
> [~] $hello
> BASH.EXE: hello: command not found
>
> Some more tries:
>
> [~] $HELLO
> BASH.EXE: HELLO: command not found
> [~] $hello.exe
> BASH.EXE: hello.exe: command not found
> [~] $HELLO.exe
> BASH.EXE: HELLO.exe: command not found
>
> It doesn't work from within the terminal window but it works from
> the outside: Double clicking on it. That's problem 1.

Here's the answer for problem 1 (my guess at least).  You don't have dot
in your path - try doing
$ export PATH=.:$PATH
or alternatively, run it using
$ ./hello

> Here is problem 2:
>
> [~] $ls -l
> total 194
> drwxr-xr-x   2 dajoy    everyone        0 Jul 11 21:38 ./
> drwxr-xr-x  16 dajoy    everyone        0 Dec 31  1969 ../
> -rw-r--r--   1 dajoy    everyone     3831 Jul 11 21:39 .bash_history
> -rwxr-xr-x   1 dajoy    everyone      283 Jan 30 19:16 .bash_login*
> -rw-r--r--   1 dajoy    everyone      193 Jul 10 00:45 .bashrc
> -rw-r--r--   1 dajoy    everyone      869 Jan 26 11:03 .emacs
> -rw-r--r--   1 dajoy    everyone       20 Jul 11 20:02 .less
> -rw-r--r--   1 dajoy    everyone       26 Jul 11 20:02 .lesskey
> -rw-r--r--   1 dajoy    everyone     6926 Jan 26 11:03 .swarmArchiver
> -rw-r--r--   1 dajoy    everyone       35 Jul 11 22:37 hello.c
> -rwxr-xr-x   1 dajoy    everyone   299710 Jul 11 22:37 hello.exe*
> -rw-r--r--   1 dajoy    everyone       82 Jul  9 13:50 man.cfg
> -rwxr-xr-x   1 dajoy    everyone    68608 Dec  1  1998 sh.exe*
>
> hello.exe is HUGE. Why? What am I doing wrong?

It will be that huge (and on mine, it's 302k).  It full of lovely symbols
and stuff.
try a:
$strip hello.exe
It will drop down to about 3k :)


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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