public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* problem with runningsimple C program
@ 2003-06-25 21:40 Milos Puzovic
  2003-06-25 21:42 ` Hannu E K Nevalainen (garbage mail)
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Milos Puzovic @ 2003-06-25 21:40 UTC (permalink / raw)
  To: cygwin

I was trying to run the following simple C code:

void func();

main() {
   func();
   }

void func() { printf("Hello world from func()!"); }

First, I compiled it with gcc program.c -o program. Then I tried to run 
it, but I got "Segmentation fault (core dumped)" message.

The version of gcc is 3.2 20020927 (prerelease).

Best wishes,
Milos.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: problem with runningsimple C program
  2003-06-25 21:40 problem with runningsimple C program Milos Puzovic
@ 2003-06-25 21:42 ` Hannu E K Nevalainen (garbage mail)
  2003-06-25 21:45 ` Max Bowsher
  2003-06-26  4:34 ` VSong
  2 siblings, 0 replies; 5+ messages in thread
From: Hannu E K Nevalainen (garbage mail) @ 2003-06-25 21:42 UTC (permalink / raw)
  To: cygwin

> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Milos Puzovic
>
>
> I was trying to run the following simple C code:
>
> void func();
>
> main() {
>    func();
>    }
>
> void func() { printf("Hello world from func()!"); }
>
> First, I compiled it with gcc program.c -o program. Then I tried to run
> it, but I got "Segmentation fault (core dumped)" message.
>
> The version of gcc is 3.2 20020927 (prerelease).


Hannu@P450 ~/Projects
<xc=0> $ cat >z.c
void func();

main() {
   func();
   }

void func() { printf("Hello world from func()!"); }
Hannu@P450 ~/Projects
<xc=0> $ gcc -o z z.c
Hannu@P450 ~/Projects
<xc=0> $ ./z
Hello world from func()!Hannu@P450 ~/Projects
<xc=24> $ gcc --version
gcc (GCC) 3.2 20020927 (prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Hannu@P450 ~/Projects
<xc=0> $ uname -a
CYGWIN_NT-5.0 P450 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unknown unknown
Cygwin
Hannu@P450 ~/Projects
<xc=0> $

--

i.e. WFM. BTW, use "int main() { ...; return 0;}" - even in test code.

As you can see the amount of characters printed in func() gets sent as exit
code.
Did you expect that? ;-)


/Hannu E K Nevalainen, 59~14'N, 17~12'E
 ~ <=> degree

--

--END OF MESSAGE--


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problem with runningsimple C program
  2003-06-25 21:40 problem with runningsimple C program Milos Puzovic
  2003-06-25 21:42 ` Hannu E K Nevalainen (garbage mail)
@ 2003-06-25 21:45 ` Max Bowsher
  2003-06-26  0:57   ` Milos Puzovic
  2003-06-26  4:34 ` VSong
  2 siblings, 1 reply; 5+ messages in thread
From: Max Bowsher @ 2003-06-25 21:45 UTC (permalink / raw)
  To: Milos Puzovic, cygwin

Milos Puzovic wrote:
> I was trying to run the following simple C code:
> 
> void func();
> 
> main() {
>    func();
>    }
> 
> void func() { printf("Hello world from func()!"); }
> 
> First, I compiled it with gcc program.c -o program. Then I tried to run
> it, but I got "Segmentation fault (core dumped)" message.
> 
> The version of gcc is 3.2 20020927 (prerelease).

Works for me. Have you oversimplified this example?


Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problem with runningsimple C program
  2003-06-25 21:45 ` Max Bowsher
@ 2003-06-26  0:57   ` Milos Puzovic
  0 siblings, 0 replies; 5+ messages in thread
From: Milos Puzovic @ 2003-06-26  0:57 UTC (permalink / raw)
  To: Max Bowsher; +Cc: cygwin

Max Bowsher wrote:
> Works for me. Have you oversimplified this example?
Strange! I have just reinstalled whole cygwin, compiled the code and it 
was working. Still don't know what was the problem.

Milos.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problem with runningsimple C program
  2003-06-25 21:40 problem with runningsimple C program Milos Puzovic
  2003-06-25 21:42 ` Hannu E K Nevalainen (garbage mail)
  2003-06-25 21:45 ` Max Bowsher
@ 2003-06-26  4:34 ` VSong
  2 siblings, 0 replies; 5+ messages in thread
From: VSong @ 2003-06-26  4:34 UTC (permalink / raw)
  To: cygwin

I tried it and it worked fine for me.

"Milos Puzovic" <mp1102@doc.ic.ac.uk> wrote in message
news:3EF9DEB5.1040601@doc.ic.ac.uk...
> I was trying to run the following simple C code:
>
> void func();
>
> main() {
>    func();
>    }
>
> void func() { printf("Hello world from func()!"); }
>
> First, I compiled it with gcc program.c -o program. Then I tried to run
> it, but I got "Segmentation fault (core dumped)" message.
>
> The version of gcc is 3.2 20020927 (prerelease).
>
> Best wishes,
> Milos.
>
>




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-06-25 21:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-25 21:40 problem with runningsimple C program Milos Puzovic
2003-06-25 21:42 ` Hannu E K Nevalainen (garbage mail)
2003-06-25 21:45 ` Max Bowsher
2003-06-26  0:57   ` Milos Puzovic
2003-06-26  4:34 ` VSong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).