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.