[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] compilation error on mingw
From: |
Stephen Leake |
Subject: |
Re: [Monotone-devel] compilation error on mingw |
Date: |
Tue, 24 Nov 2009 09:44:49 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (windows-nt) |
Stephen Leake <address@hidden> writes:
> With nvm.monotone head (033d74ef283f7bc7c27068ce548687c08cfbbed8
> address@hidden 2009-11-20T22:04:15) I'm getting compilation
> errors on Mingw (g++.exe (GCC) 3.4.5 (mingw-vista special r3)) (after
> a clean start from scratch):
>
> In file included from ../monotone/cmd_netsync.cc:14:
> ../monotone/automate_ostream_demuxed.hh:24: error: declaration of
> `_iob' as array of references
I found the cause for this, and a fix (patch below).
The code in automate_ostream_demuxed.hh is:
class basic_automate_streambuf_demuxed : public std::basic_streambuf<_CharT,
_Traits>
{
typedef _Traits traits_type;
typedef typename _Traits::int_type int_type;
size_t _bufsize;
std::basic_ostream<_CharT, _Traits> *stdout;
std::basic_ostream<_CharT, _Traits> *errout;
int err_code;
public:
'stdout' is implemented as a macro in c:/MinGW/include/stdio.h:
#define stdout (&_iob[STDOUT_FILENO])
so the syntax in the definition of the class member 'stdout' gets
mangled, and the name of the member changed to _iob.
moral; never use any identifiers that are defined in the C library;
they could easily be macros.
Changing 'stdout' to anything else that is not a macro fixes the
problem. I used 'mystdout'; is there a convention for this sort of
thing?
--
-- Stephe
$ mtn diff
#
# old_revision [033d74ef283f7bc7c27068ce548687c08cfbbed8]
#
# patch "INSTALL"
# from [36d003d8553647452627f33476a5d7556052e423]
# to [7a58e87c176731e5d0e7b48e28810053174b0f48]
#
# patch "automate_ostream_demuxed.hh"
# from [29fd0c1a2de69865bdd348145ae8bcef351b2ee0]
# to [e3e8b950285ac4f040b81bc895eb37d63523dff8]
#
============================================================
--- INSTALL 36d003d8553647452627f33476a5d7556052e423
+++ INSTALL 7a58e87c176731e5d0e7b48e28810053174b0f48
@@ -206,9 +206,9 @@ 1. prerequisites:
15. build monotone
$ cd /c/.../monotone
- $ export PATH=/bin:$PATH
+ $ export PATH=/bin:/mingw/bin
$ autoreconf -i
- $ ./configure sqlite_LIBS=-lsqlite3
+ $ ./configure sqlite3_LIBS=-lsqlite3
$ make
on Windows (using Cygwin):
============================================================
--- automate_ostream_demuxed.hh 29fd0c1a2de69865bdd348145ae8bcef351b2ee0
+++ automate_ostream_demuxed.hh e3e8b950285ac4f040b81bc895eb37d63523dff8
@@ -21,7 +21,7 @@ class basic_automate_streambuf_demuxed :
typedef _Traits traits_type;
typedef typename _Traits::int_type int_type;
size_t _bufsize;
- std::basic_ostream<_CharT, _Traits> *stdout;
+ std::basic_ostream<_CharT, _Traits> *mystdout;
std::basic_ostream<_CharT, _Traits> *errout;
int err_code;
public:
@@ -29,7 +29,7 @@ public:
size_t bufsize) :
std::streambuf(),
_bufsize(bufsize),
- stdout(&out),
+ mystdout(&out),
errout(&err),
err_code(0)
{
@@ -70,7 +70,7 @@ private:
void _M_sync()
{
std::basic_ostream<_CharT, _Traits> *str;
- str = ((err_code != 0) ? errout : stdout);
+ str = ((err_code != 0) ? errout : mystdout);
if (!str)
{
setp(this->pbase(), this->pbase() + _bufsize);