Compiler error C2146 in standard header file

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
 
J

Jeff Partch

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
 
A

Arjun Bijanki [VCPP MSFT]

--------------------
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?
 
A

Arjun Bijanki [VCPP MSFT]

--------------------
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.").
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top