Article View: gnu.gcc.help
Article #41962Re: Undeclared reference to main?
From: Eugene Mesgar
Date: Tue, 30 Jan 1996 00:00
Date: Tue, 30 Jan 1996 00:00
16 lines
1023 bytes
1023 bytes
when linking the program, you have to tell the linker to include the math lib (math functions are not included in the stdlib).. Here is an example gcc -o mytestprogram test.c -lm Eugene Mesgar mesgar@netaxs.com Charles Nichols (cnichols@ix.netcom.com) wrote: : Whenever I try to compile a C program using a math.h function (abs, : sqrt, etc) the compiler generates an "undeclared reference to main" : message. The identical program compiles fine using Borland's Turbo C : on the same computer (386sx). What does the message mean and why : doesn't it compile? : Charles Nichols
Technical Details
Message-ID:
<4elu02$i87@netaxs.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4edn1f$g5a@ixnews4.ix.netcom.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,16eff1441788ea25 X-Google-Attributes: gid11318c,public From: mesgar@unix5.netaxs.com (Eugene Mesgar) Subject: Re: Undeclared reference to main? Date: 1996/01/30 Message-ID: <4elu02$i87@netaxs.com> X-Deja-AN: 137257997 references: <4edn1f$g5a@ixnews4.ix.netcom.com> organization: Philadelphia's Complete Internet Provider newsgroups: gnu.gcc.help