Compiler error C2146 in standard header file

  • Thread starter Thread starter Cliff Cooley
  • Start date Start date
C

Cliff Cooley

I'm trying to compile a VC++7 application from code loaded
from a VC++6 project, but I keep getting the following
compiler warning ->

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
\PlatformSDK\Include\MSWSock.h(239) : error C2146: syntax
error : missing ',' before identifier 'OPTION'

which relates the following typedef in the standard
MSWSock.h header file ->

typedef
BOOL
(PASCAL FAR * LPFN_CONNECTEX) (
IN SOCKET s,
IN const struct sockaddr FAR *name,
IN int namelen,
IN PVOID lpSendBuffer OPTIONAL,
IN DWORD dwSendDataLength,
OUT LPDWORD lpdwBytesSent,
IN LPOVERLAPPED lpOverlapped
);

Any ideas why this is happening ?

Many thanks

Cliff Cooley
 
Cliff Cooley said:
I'm trying to compile a VC++7 application from code loaded
from a VC++6 project, but I keep getting the following
compiler warning ->

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
\PlatformSDK\Include\MSWSock.h(239) : error C2146: syntax
error : missing ',' before identifier 'OPTION'

which relates the following typedef in the standard
MSWSock.h header file ->

typedef
BOOL
(PASCAL FAR * LPFN_CONNECTEX) (
IN SOCKET s,
IN const struct sockaddr FAR *name,
IN int namelen,
IN PVOID lpSendBuffer OPTIONAL,
IN DWORD dwSendDataLength,
OUT LPDWORD lpdwBytesSent,
IN LPOVERLAPPED lpOverlapped
);

Any ideas why this is happening ?

No good ideas, but OPTIONAL should be #defined in WinDef.h like so...

#ifndef OPTIONAL
#define OPTIONAL
#endif
 
--------------------
Content-Class: urn:content-classes:message
From: "Cliff Cooley" <cliff@home>
Sender: "Cliff Cooley" <cliff@home>
Subject: Compiler error C2146 in standard header file
Date: Mon, 4 Aug 2003 08:05:03 -0700
Any ideas why this is happening ?

Make sure you have windows.h included first. Does that fix it?
 
--------------------
From: "Cliff Cooley" <cliff@home>
Sender: "Cliff Cooley" <cliff@home>
References: <[email protected]>
Subject: RE: Compiler error C2146 in standard header file
If I force the inclusion of windows.h, I get another fatal
error C1189, which says MFC applications mustn't include
windows.h

I'm not sure what's going on. It's almost certainly related to header file
include order, though. Can you make a sample solution that reproduces the
problem, and sent it my way? ([email protected], remove
"onlinenospam.").
 
Back
Top