public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: GRE Spam Mail <gre_spam@anora.org>
To: bjensen@fastmail.fm
Cc: gcc-help@gcc.gnu.org
Subject: Re: undefined reference to `__errno_location(void)'
Date: Wed, 04 Sep 2002 07:51:00 -0000	[thread overview]
Message-ID: <20020904105144.0ccf54a0.gre_spam@anora.org> (raw)
In-Reply-To: <3D75B5F8.7010203@fastmail.fm>

On Wed, 04 Sep 2002 09:27:52 +0200
bjorn rohde jensen <bjensen@fastmail.fm> 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 <cstdio>
#include <cerrno>
#include <cstring>

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.

  reply	other threads:[~2002-09-04 14:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <616BE6A276E3714788D2AC35C40CD18D7D2511@whale.softwire.co.uk>
2002-09-01 23:38 ` Rupert Wood
2002-09-02 10:06   ` GRE Spam Mail
2002-09-02 10:14     ` undefined reference to `__errno_location(void)'x Der Herr Hofrat
2002-09-02 10:53       ` GRE Spam Mail
2002-09-03 13:09         ` GRE Spam Mail
2002-09-04  0:28           ` bjorn rohde jensen
2002-09-04  7:51             ` GRE Spam Mail [this message]
2002-09-04  9:03               ` undefined reference to `__errno_location(void)' Claudio Bley
2002-09-04  9:20                 ` Rupert Wood
2002-09-04 17:27                   ` GRE Spam Mail
2002-09-02 10:07   ` GRE Spam Mail

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020904105144.0ccf54a0.gre_spam@anora.org \
    --to=gre_spam@anora.org \
    --cc=bjensen@fastmail.fm \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).