This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: w32api/windef.h


----- Original Message -----
From: Igor Pechtchanski <pechtcha@cs.nyu.edu>
Date: Mon, 9 Jun 2003 09:17:21 -0400 (EDT)
To: Lionel Zhou <lzhou@verizonmail.com>
Subject: Re: w32api/windef.h

> On Sun, 8 Jun 2003, Lionel Zhou wrote:
> 
> > ----- Original Message -----
> > From: Christopher Faylor <cgf-rcm@cygwin.com>
> > Date: Sun, 8 Jun 2003 11:21:43 -0400
> > To: cygwin@cygwin.com
> > Subject: Re: w32api/windef.h
> >
> > > On Sun, Jun 08, 2003 at 07:19:30AM -0500, Lionel Zhou wrote:
> > > >In file included from utils.c:4:
> > > >/usr/include/w32api/windef.h:273: parse error before "void"
> > > >
> > > >has anyone successfully used the windef.h header and could you tell me
> > > >how to compile program like this?
> > > >
> > > >my windef.h is attached here.
> > >
> > > #include <windows.h>
> > >
> > > Not windef.h.  That might help.
> > >
> > > cgf
> >
> > thank you christopher and elfyn,
> >
> > i tried your advice but it doesn't solve the problem.
> >
> > grep windef /usr/local/w32api/windows.h
> > #include <windef.h>
> >
> > so that windows.h is just a superset of header definitions which
> > includes windef.h
> >
> > program compile with the same error:
> >
> > In file included from windows.h:48:
> >                  from utils.c:4:
> > /usr/include/w32api/windef.h:273: parse error before "void"
> >
> > grep void /usr/include/w32api/windef.h
> > #define NULL ((void*)0)
> > typedef CONST void *PCVOID,*LPCVOID;
> > typedef void *HGDIOBJ;
> >
> > i also tried the -mwin32 compile flag which lead to more errors because
> > of conflicting definitions. the program is wrote for linux and is being
> > ported to windows. this is about the only function that uses win32 api
> > in this program.
> >
> > lionel
> 
> Lionel,
> 
> Check the part of your program *before* the '#include "windows.h"' (either
> the program itself, or the header files).  This could be a common C
> problem with a missing semicolon after a struct definition (e.g.,
> something like
> 
> struct AAA {
>   int blah;
> }
> 
> void main(void) { ... }
> 
> will give you a similar error).
> 	Igor
> -- 
> 				http://cs.nyu.edu/~pechtcha/
>       |\      _,,,---,,_		pechtcha@cs.nyu.edu
> ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
>      |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
>     '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
> 
> "I have since come to realize that being between your mentor and his route
> to the bathroom is a major career booster."  -- Patrick Naughton
> 

thank you prof. igor,

this is not the problem here. i have made a test program like this.

----utils.c----
#include "ffss.h"  
#include "utils.h"
#include <windef.h>

char *FFSS_GetOS(void)
{
  return FFSS_SERVER_OS;
}
----end here----

this short program won't compile, no win32 api is used.

In file included from utils.c:4:
/usr/include/w32api/windef.h:273: parse error before "void"

how ever, if i change the order of the headers, like this:

----utils2.c----
#include <windef.h>
#include "ffss.h"  
#include "utils.h"

char *FFSS_GetOS(void)
{
  return FFSS_SERVER_OS;
}
----end here----

this still don't compile and a lot of errors crop out.


In file included from ffss.h:58,
                 from utils.c:3:
/usr/include/bzlib.h:163: two or more data types in declaration of `type name'
/usr/include/bzlib.h:186: two or more data types in declaration of `type name'
/usr/include/bzlib.h:262: two or more data types in declaration of `type name'
In file included from utils.c:3:
ffss.h:64:1: warning: "LOG_INFO" redefined
In file included from /usr/include/syslog.h:14,
                 from /usr/local/include/skyutils.h:256,
                 from ffss.h:49,
                 from utils.c:3:
/usr/include/sys/syslog.h:21:1: warning: this is the location of the previous definition
In file included from utils.c:3:
ffss.h:65:1: warning: "LOG_WARNING" redefined
In file included from /usr/include/syslog.h:14,
                 from /usr/local/include/skyutils.h:256,
                 from ffss.h:49,
                 from utils.c:3:
/usr/include/sys/syslog.h:19:1: warning: this is the location of the previous definition
In file included from utils.c:3:
ffss.h:66:1: warning: "LOG_ERR" redefined
In file included from /usr/include/syslog.h:14,
                 from /usr/local/include/skyutils.h:256,
                 from ffss.h:49,
                 from utils.c:3:
/usr/include/sys/syslog.h:18:1: warning: this is the location of the previous definition
In file included from /usr/include/sys/socket.h:15,
                 from /usr/include/cygwin/if.h:19,
                 from /usr/include/net/if.h:14,
                 from utils.h:6,
                 from utils.c:4:
/usr/include/cygwin/socket.h:18: redefinition of `struct sockaddr'
In file included from /usr/include/sys/socket.h:15,
                 from /usr/include/cygwin/if.h:19,
                 from /usr/include/net/if.h:14,
                 from utils.h:6,
                 from utils.c:4:
/usr/include/cygwin/socket.h:28: redefinition of `struct linger'
In file included from /usr/include/cygwin/if.h:19,
                 from /usr/include/net/if.h:14,
                 from utils.h:6,
                 from utils.c:4:
/usr/include/sys/socket.h:29: conflicting types for `accept'
/usr/include/w32api/winsock2.h:515: previous declaration of `accept'
/usr/include/sys/socket.h:30: conflicting types for `bind'
/usr/include/w32api/winsock2.h:516: previous declaration of `bind'
/usr/include/sys/socket.h:31: conflicting types for `connect'
/usr/include/w32api/winsock2.h:518: previous declaration of `connect'
/usr/include/sys/socket.h:32: conflicting types for `getpeername'
/usr/include/w32api/winsock2.h:520: previous declaration of `getpeername'
/usr/include/sys/socket.h:33: conflicting types for `getsockname'
/usr/include/w32api/winsock2.h:521: previous declaration of `getsockname'
/usr/include/sys/socket.h:34: conflicting types for `listen'
/usr/include/w32api/winsock2.h:525: previous declaration of `listen'
/usr/include/sys/socket.h:35: conflicting types for `recv'
/usr/include/w32api/winsock2.h:526: previous declaration of `recv'
/usr/include/sys/socket.h:37: conflicting types for `recvfrom'
/usr/include/w32api/winsock2.h:527: previous declaration of `recvfrom'
/usr/include/sys/socket.h:39: conflicting types for `send'
/usr/include/w32api/winsock2.h:528: previous declaration of `send'
/usr/include/sys/socket.h:42: conflicting types for `sendto'
/usr/include/w32api/winsock2.h:529: previous declaration of `sendto'
/usr/include/sys/socket.h:43: conflicting types for `setsockopt'
/usr/include/w32api/winsock2.h:530: previous declaration of `setsockopt'
/usr/include/sys/socket.h:44: conflicting types for `getsockopt'
/usr/include/w32api/winsock2.h:522: previous declaration of `getsockopt'
/usr/include/sys/socket.h:45: conflicting types for `shutdown'
/usr/include/w32api/winsock2.h:531: previous declaration of `shutdown'
/usr/include/sys/socket.h:46: conflicting types for `socket'
/usr/include/w32api/winsock2.h:532: previous declaration of `socket'
/usr/include/sys/socket.h:49: conflicting types for `getservbyname'
/usr/include/w32api/winsock2.h:536: previous declaration of `getservbyname'

i need to check the iso standard of c to see if the order of included headers is consequencial for compilers. this caught me in surprise

lionel



-- 
_______________________________________________
Get your free Verizonmail at www.verizonmail.com


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]