*BSD News Article 17118


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!bruce.cs.monash.edu.au!monu6!escargot!kittyhawk!raemph
From: raemph@kittyhawk.aero.rmit.OZ.AU (Martin P. Howell)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: stdio.h & __sputc problems with gcc -ansi
Date: 14 Jun 1993 14:35:26 GMT
Organization: Royal Melbourne Institute of Technology
Lines: 29
Message-ID: <1vi2be$qo4@escargot.xx.rmit.OZ.AU>
References: <1vhfrt$p3p@escargot.xx.rmit.OZ.AU>
NNTP-Posting-Host: kittyhawk.aero.rmit.oz.au

rxklam@minyos.xx.rmit.OZ.AU (Luke Mewburn) writes:


>I've discovered an annoying problem in <stdio.h> when running
>gcc (1.40 or whatever's the default) with -ansi, and a project with
>multiple .o files.

>When gcc gets around to linking, I get "multiply defined __sputc"
>errors (I can't remember the exact text, this is from memory).
>Looking in stdio.h, I see that __sputc is defined as 
>	static __inline

In fact, __sputc is defined as 

static inline 

without the leading underscores (at least in both 386bsd 0.1 and NetBSD).
When the -ansi switch is given, gcc seems to ignore both the static and
the inline rather than giving an error, hence making the function global.

Just add two underscores to the inline in /usr/include/stdio.h as in

static __inline int __sputc(int _c, FILE _p) {

and the problem will go away (presumably this lack of underscores is just
a typing mistake).

-Martin.
raemph@kittyhawk.aero.rmit.oz.au