delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/26/01:48:35

Date: Thu, 26 Jun 1997 08:46:59 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Thomas Christensen <Thomas_Christensen AT bc DOT sympatico DOT ca>
cc: djgpp AT delorie DOT com
Subject: Re: Help - Warnings from compiler
In-Reply-To: <5oq596$5nc$1@news.bctel.net>
Message-ID: <Pine.SUN.3.91.970626084616.13075B-100000@is>
MIME-Version: 1.0

On Wed, 25 Jun 1997, Thomas Christensen wrote:

> When I compile a small program, which has 
> #include <cinio.h>
> #include <pc.h>
> in it I get 2 warnings
> 
> .../pc.h(32) Warning: redundant redeclaration of `_conio_kbhit' in
> same scope

<pc.h> declares `kbhit', but <conio.h> both defines it to be
`_conio_kbhit' and declares `_conio_kbhit', so gcc sees two
declarations of `_conio_kbhit'.  Usually, gcc doesn't complain about
such cases *unless* you use the `-Wredundant-decls' option (-Wall
doesn't turn it on).  Did you indeed use this option?  If so, you
should have told this in your message, as its usage is non-standard.

A simple solution is not to use `-Wredundant-decls'; it is redundant
;-) But if you want to stick to it, you need to decide whether you
indeed need to include both of these headers (most programs only need
one, but not the other).  If you *do* need them both, include <pc.h>
first:

	#include <pc.h>
	#include <conio.h>

This should work even with `-Wredundant-decls' (it did for me).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019