in reply to perlxs and c++ : dosish.h(111) : warning C4005: 'Stat' : macro redefinition

You are getting an error about Stat being redefined but I don't see any mention of you looking at the definitions of Stat. I did a quick look and found that the one in win32.h goes like this:

#undef Stat #define Stat win32_stat
so it appears that win32.h expects to be included after dosish.h.

So I'd investigate why they are being included in the wrong order.

All copies of perl.h that I have handy only mention perl_os_thread in lines like

typedef pthread_t perl_os_thread;
and typedef is a reserved word in C so I don't see how you could get that error unless pthread_t is #defined to be something that at least contains whitespace. You might want to use -E (or whatever) to see what output the C preprocessor is producing.

                - tye
  • Comment on Re: perlxs and c++ : dosish.h(111) : warning C4005: 'Stat' : macro redefinition (debug)
  • Select or Download Code

Replies are listed 'Best First'.
Re: Re: perlxs and c++ : dosish.h(111) : warning C4005: 'Stat' : macro redefinition (debug)
by PodMaster (Abbot) on Apr 28, 2003 at 17:09 UTC
    I have seen that, but didn't conclude that "so it appears that win32.h expects to be included after dosish.h.".

    From what I can gather by examining perl.h , it is being included after.

    Thats still my impression after inspecing Compress.i (produced by -P with -C). You can get it at http://crazyinsomniac.perlmonk.org/perl/misc/Coordinate.i.bz2 if you wanna take a peek.

    So I looked up C2146 and ran into C2065 (missed it before), and under MSDN, some of the more notable tips were

    Make sure any include file containing the required declaration is not omitted.

    Make sure you are including any necessary header files if you have defined VC_EXTRALEAN, WIN32_LEAN_AND_MEAN, or WIN32_EXTRA_LEAN. Defining these symbols excludes some functionality (certain header files are excluded) from windows.h and afxv_w32.h (for MFC applications) to speed compiles. Search windows.h and afxv_w32.h for these symbols for the most up-to-date description of what is excluded.

    win32.h does define WIN32_LEAN_AND_MEAN. And WINDOWS.H does have
    #ifndef WIN32_LEAN_AND_MEAN #include <cderr.h> #include <dde.h> #include <ddeml.h> #include <dlgs.h> #ifndef _MAC #include <lzexpand.h> #include <mmsystem.h> #include <nb30.h> #include <rpc.h> #endif #include <shellapi.h> #ifndef _MAC #include <winperf.h> #if(_WIN32_WINNT >= 0x0400) #include <winsock2.h> #include <mswsock.h> #else #include <winsock.h> #endif /* _WIN32_WINNT >= 0x0400 */ #endif #ifndef NOCRYPT #include <wincrypt.h> #endif #ifndef NOGDI #include <commdlg.h> #ifndef _MAC #include <winspool.h> #ifdef INC_OLE1 #include <ole.h> #else #include <ole2.h> #endif /* !INC_OLE1 */ #endif /* !MAC */ #endif /* !NOGDI */ #endif /* WIN32_LEAN_AND_MEAN */
    But this is largely a dead end.

    update: I have also posted this as a question over at the Extending And Embedding forum as Compiling ExtEmbPerlSrc_v0_90/chap6/6.8.1 on Win32 in hopes the authors will be able to help out.

    Maybe later (if i don't figure it out) i'll inquire on one of the mailing lists as well (maybe p5p).


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.