delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/17/01:16:44

From: "Marp" <marp AT 0 DOT 0 DOT 0 DOT 0>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: warning: `struct MyStruct' declared inside parameter list
Date: Fri, 17 Nov 2000 01:01:36 -0500
Organization: MindSpring Enterprises
Lines: 52
Message-ID: <8v2hi0$m0b$1@slb3.atl.mindspring.net>
References: <3a1455f7 DOT 1211889044 AT news DOT connectnet DOT com>
NNTP-Posting-Host: 04.30.99.99
X-Server-Date: 17 Nov 2000 06:00:32 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

The problem is that def1.h includes proto.h before defining struct MyStruct
and proto.h has function prototypes that need that structure to be already
defined. The solution is to move the structure definition in def1.h above
the inclusion of proto.h (since def1.h includes proto.h).

The reason it worked in the Microsoft compiler is because they have a
different interpretation of the ansi c specs.

Hope this helps.

Marp


"John Vasquez" <jvasquez AT getntds DOT com> wrote in message
news:3a1455f7 DOT 1211889044 AT news DOT connectnet DOT com...
> Newbie:
> Trying to convert and existing DOS 16-program to 32-bit.
>
> The original program was written in Microsoft C V6.0.
>
> I get the following error:
> In file included from def1.h:57,
>                  from code.c:22:
> proto.h:8: warning: `struct MyStruct' declared inside parameter list
> proto.h:8: warning: its scope is only this definition or declaration,
> which is probably not what you want.
> What does that mean? I haven't been able to figure it out.
>
> In my def1.h file I have a structure defined:
>
> struct MyStruct
> {
> int field1
> int field2
> };
>
> In proto .h file I define the function proto type as
> int MyFunction(struct MyStruct *);
>
> In the code.c file I define the structure:
> #include def1.h
> #include proto.h
> int MyFunction(struct MyStruct *ptr)
> {
> MyCode;
> .
> .
> .
> return stuff;
> }


- Raw text -


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