Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #138393
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 |
| Date | 2018-11-29 08:15 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <ptoop9$lfa$1@dont-email.me> (permalink) |
| References | (4 earlier) <ptbsvdhcsvf7sdqii5r1ckspjq0gm250v6@4ax.com> <g66vc6F8pfeU7@mid.individual.net> <i5itvdtvf2144tjo348v335j88sgq079c6@4ax.com> <c1a591f3-47ca-478f-9ff7-f36cd7b9ae7e@googlegroups.com> <40avvd9al7gljm349l9tjqv3p544821kmu@4ax.com> |
On 11/29/18 04:35, Geoff wrote:
> On Wed, 28 Nov 2018 11:01:46 -0800 (PST),
> jameskuyper@alumni.caltech.edu wrote:
>
>> On Wednesday, November 28, 2018 at 1:30:56 PM UTC-5, Geoff wrote:
>>> On Wed, 28 Nov 2018 20:45:10 +1300, Ian Collins <ian-news@hotmail.com>
>>> wrote:
>> ...
>>>> OK, I assume there's a g_ai.c somewhere, could there be another
>>>> definition there? Do both files include <stdlib.h>?
>>>
>>> No element of the project /defines/ these functions, which is why I'm
>>> mystified as to why the code is suddenly broken with an upgrade of the
>>> OS & compiler. All the .c files include a master header that includes
>>> the standard headers you see listed above. It's quite possible a
>>> standard header might be included more than once but it was my
>>> understanding they were all required to be idempotent for that
>>> translation unit. Nevertheless, I will review and remove any redundant
>>> includes.
>>>
>>> There are macro guards installed in all the project headers so no .c
>>> file can include any project header more than once. The makefile and
>>> all project code has not changed since compiling and linking correctly
>>> on the old OS. g_ai.c is the first module compiled but atoi is not
>>> called or defined within g_ai.c.
>> ...
>>> Interestingly, I have solved the linking problem by setting -std=gnu89
>>> instead of -std=gnu99. Now, what's different (besides 10 years) about
>>> the nature of the compiler with those switches?
>>
>> Rebuild any one of the modules which provokes this message, using
>> -std=gnu99 -E, and using -o to name the output file. Look in the output
>> file and see if it contains anything that looks, syntactically at least,
>> like a definition of one of the relevant functions, rather than a
>> declaration.
>> Note that, since you're compiling as GnuC, rather than C, it would be
>> more appropriate to ask this question in a Gnu-oriented forum. GnuC
>> differs from C in many ways, and you'll get better answers if you ask
>> people who are more familiar with those differences than I am.
>
> The -E switch disclosed the nature of the problem.
> The implementation is inlining the functions in conflict. Example:
>
> extern __inline int
> atoi (const char *__nptr)
> {
> return (int) strtol (__nptr, (char **) ((void *)0), 10);
> }
User code containing such a definition would have undefined behavior by
reason of defining a reserved identifier, so a C compiler is free to
reject such code. However, a standard header, which is part of the
implementation, could contain such code - but it can combine with a C
compiler to form a conforming implementation of C only if the C compiler
does not reject such code, when it is #included from a standard header.
I suspect that the underlying problem is that you're using an
implementation of the C standard library that isn't compatible with the
gcc -std=gnu99, but is compatible with gcc -std=gnu89.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-27 14:38 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Ian Collins <ian-news@hotmail.com> - 2018-11-28 15:37 +1300
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-27 19:53 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Ian Collins <ian-news@hotmail.com> - 2018-11-28 17:42 +1300
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-27 22:06 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Ian Collins <ian-news@hotmail.com> - 2018-11-28 20:45 +1300
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-28 10:30 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 jameskuyper@alumni.caltech.edu - 2018-11-28 11:01 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-29 01:35 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-11-29 08:15 -0500
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-30 12:48 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-30 14:49 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Keith Thompson <kst-u@mib.org> - 2018-11-30 14:56 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-30 15:46 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 David Brown <david.brown@hesbynett.no> - 2018-12-01 17:51 +0100
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Richard Damon <Richard@Damon-Family.org> - 2018-12-01 13:37 -0500
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 David Brown <david.brown@hesbynett.no> - 2018-12-02 12:49 +0100
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Richard Damon <Richard@Damon-Family.org> - 2018-12-02 08:16 -0500
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 David Brown <david.brown@hesbynett.no> - 2018-12-02 14:45 +0100
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-12-04 08:51 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 scott@slp53.sl.home (Scott Lurndal) - 2018-12-04 17:16 +0000
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 William Ahern <william@25thandClement.com> - 2018-12-04 12:26 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-12-05 07:08 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 William Ahern <william@25thandClement.com> - 2018-12-05 13:39 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-12-05 20:25 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Tim Rentsch <txr@alumni.caltech.edu> - 2018-12-06 07:01 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Tim Rentsch <txr@alumni.caltech.edu> - 2018-11-29 10:26 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-30 12:59 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Tim Rentsch <txr@alumni.caltech.edu> - 2018-12-01 07:23 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Tim Rentsch <txr@alumni.caltech.edu> - 2018-12-02 03:56 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-12-02 08:10 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Tim Rentsch <txr@alumni.caltech.edu> - 2018-12-03 14:00 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Nick Bowler <nbowler@draconx.ca> - 2018-11-28 19:42 +0000
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Tim Rentsch <txr@alumni.caltech.edu> - 2018-11-29 10:09 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 jameskuyper@alumni.caltech.edu - 2018-11-28 05:55 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-28 10:36 -0800
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Bart <bc@freeuk.com> - 2018-11-28 13:13 +0000
Re: Multiple Includes Causing Multiple Definitions? (GCC 6.3.0) on Debian 9 Geoff <geoff@invalid.invalid> - 2018-11-30 13:39 -0800
csiph-web