Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Hannu E K Nevalainen \(garbage mail\)" To: Subject: RE: problem with runningsimple C program Date: Wed, 25 Jun 2003 21:16:57 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <3EF9DEB5.1040601@doc.ic.ac.uk> Importance: Normal > From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT 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 AT P450 ~/Projects $ cat >z.c void func(); main() { func(); } void func() { printf("Hello world from func()!"); } Hannu AT P450 ~/Projects $ gcc -o z z.c Hannu AT P450 ~/Projects $ ./z Hello world from func()!Hannu AT P450 ~/Projects $ 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 AT P450 ~/Projects $ uname -a CYGWIN_NT-5.0 P450 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unknown unknown Cygwin Hannu AT P450 ~/Projects $ -- 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/