Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com X-Authentication-Warning: modi.xraylith.wisc.edu: khan owned process doing -bs Date: Wed, 24 Mar 1999 11:13:48 -0600 (CST) From: Mumit Khan To: Nirmal Prasad cc: cygwin AT sourceware DOT cygnus DOT com Subject: Re: Win32 Defines & C++ In-Reply-To: <001701be7609$ef953970$0f0a0181@devel014> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 24 Mar 1999, Nirmal Prasad wrote: > This is not a cygwin related query,bug or feature request but if someone can > help it will be great b'cos i am getting this problem in some code that i > have while compiling under cygwin. Neither is this a GCC problem, since you'll get the same result with MSVC or any other C++ compiler! > The problem i am facing is that i have some c++ class that has a member > function which is the same as a win32 define (e.g. GetNextWindow). The > problem is that the pre-processor substitues this and the compiler complains > that there is something wrong. One of the solutions i thought of getting > around this is to make the #define'd macro to an inline function and the > code would then compile but this would be tedious if its a lot of macros . I > was wondering if there is any other elegant solution such that i dont have > to change any code.???? The problem of these macro definitions in Win32 API headers causes lots of problems even in standard-conformant code; the only (obvious) suggestion I can give is not to name member functions with the same name as a win32 API function (or just rename it when you find one that clashes). The API headers were designed by folks who think C is the only language, and even botches that badly. Years ago, I remember putting together a set of platform specific "undef.h" files that I would include after the system includes to avoid this mess, but that really isn't the right solution. However, since you want to avoid code changes, this may be a solution for you. Regards, Mumit -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com