From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11019 invoked by alias); 4 Sep 2002 14:51:29 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 11008 invoked from network); 4 Sep 2002 14:51:28 -0000 Received: from unknown (HELO anora.org) (12.227.4.60) by sources.redhat.com with SMTP; 4 Sep 2002 14:51:28 -0000 Received: (qmail 4195 invoked from network); 4 Sep 2002 14:51:17 -0000 Received: from unknown (HELO vaghn.anora.org) (root@192.168.1.177) by 12-227-4-60.client.attbi.com with SMTP; 4 Sep 2002 14:51:17 -0000 Date: Wed, 04 Sep 2002 07:51:00 -0000 From: GRE Spam Mail To: bjensen@fastmail.fm Cc: gcc-help@gcc.gnu.org Subject: Re: undefined reference to `__errno_location(void)' Message-Id: <20020904105144.0ccf54a0.gre_spam@anora.org> In-Reply-To: <3D75B5F8.7010203@fastmail.fm> References: <20020902130644.34af2db7.gre_spam@anora.org> <200209021618.g82GI4530795@hofr.at> <20020902135402.7c9a2d98.gre_spam@anora.org> <20020903160930.0731252b.gre_spam@anora.org> <3D75B5F8.7010203@fastmail.fm> Organization: Anora Computer Services Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2002-09/txt/msg00031.txt.bz2 On Wed, 04 Sep 2002 09:27:52 +0200 bjorn rohde jensen wrote: > Hi Gordon, > > Could you post some (small) code demonstrating the problem? > I think, you might be confusing ld's in its handling of weak/strong > symbols during linking. It would be nice with some code to experiment > with:) > > Yours sincerely, > > Bjorn > > Sure enough! Here's the smallest code that I've written that has this problem. === #include #include #include int main(int argc, char **argv) { extern int errno; FILE *fp; errno = 0; if(!(fp=fopen("Somestupidfile.txt","r"))) { printf("File error: %s\n",strerror(errno)); } else { fclose(fp); } return 0; } === This is just a stupid little code, but it demonstrates the problem. If I try to compile it with g++ I get the following errors: [root@vaghn (~/prog)] 10:42:17 $ g++ -Wall test.c -o test /tmp/ccka9V3Q.o: In function `main': /tmp/ccka9V3Q.o(.text+0x8): undefined reference to `__errno_location(void)' /tmp/ccka9V3Q.o(.text+0x3d): undefined reference to `__errno_location(void)' collect2: ld returned 1 exit status Thank you for all your help. Sincerely, Gordon R. Ellsworth, Jr.