My project compiles OK on several Linux platforms. But when I compile it under windows, it claims the following error:

In file included from D:/Strawberry-5.20.1.1-ia32/c/i686-w64-mingw32/i +nclude/c++/iostream:39:0, from D:/mydoc/projects/GenoEye-0.4.5-Source/src/genoe +ye/Common.h:9, from D:\mydoc\projects\GenoEye-0.4.5-Source\perl\geno +eye_perl.h:9, from D:\mydoc\projects\GenoEye-0.4.5-Source\perl\geno +eye_perl.cpp:1: D:/Strawberry-5.20.1.1-ia32/c/i686-w64-mingw32/include/c++/ostream:335 +:49: error: macro "PerlLIO_write" requires 3 arguments, but on ly 2 given write(const char_type* __s, streamsize __n);

This is the content around ostream line 335:

/** * @brief Character string insertion. * @param __s The array to insert. * @param __n Maximum number of characters to insert. * @return *this * * Characters are copied from @p __s and inserted into the stre +am until * one of the following happens: * * - @p __n characters are inserted * - inserting into the output sequence fails (in this case, ba +dbit * will be set in the stream's error state) * * @note This function is not overloaded on signed char and * unsigned char. */ __ostream_type& write(const char_type* __s, streamsize __n);

and this is the beginning of genoeye_perl.h, which includes both Perl headers and C++ headers:

extern "C" { #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" } #include <genoeye/Common.h> #include <genoeye/Page.h> #include <genoeye/Frame.h> #include <genoeye/Track.h> #include <genoeye/Segment.h> #include <genoeye/Elem.h> #include <genoeye/Block.h> #include <genoeye/Tag.h> #include <genoeye/Chart.h> #include <genoeye/HomologRegion.h> #include <genoeye/ElemConnect.h>

the "write" function declaration is probably conflict with Perl's internal definition. How can I solve this problem?

I'm using the MinGW toolchain provided with strawberry perl 5.20.1.1. This issue also occurs with older versions of strawberry perl.

------

Pretty sad, simply undefine the Perl-induced macro don't work

extern "C" { #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" } #undef write #include <genoeye/Common.h> ......

This does not change anything. This is very suprise.


In reply to Name conflict between MinGW C++ standard library header and Perl development header by llancet

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.