Hi,
I have a problem concerning the position of the mpatrol.h in combination
with mingw and iostream, but I'm not sure, whether mingw plays really
a role in that.
The versions, I used are: mingw 3.1.0-1 and mpatrol 1.4.8.
A very short test-program:
===========================================================
// hello.cpp
#include "C:/mingw/include/mpatrol.h" /// <-- Position 1
#include <iostream>
using namespace std;
// #include "C:/mingw/include/mpatrol.h" /// <-- Position 2
int main( int argc , char *argv[] ){
int *vector;
vector = (int*) calloc(32, sizeof(int));
vector[31] = 100;
cout << "hello world, the value is " << vector[31] << endl;
// printf("hello world, the value is %d\n", vector[31]);
free(vector);
return 1;
}
============================================================
As adviced, I linked with "-lmpatrol -lbfd -liberty -limagehlp".
With mpatrol.h in "Position 2" all works very well. I tested a
lot of MPATROL_OPTIONS and I liked very much, what I get!
But with mpatrol.h in "Position 1", which is the same as using the
"-include C:/mingw/include/mpatrol.h" - Flag when compiling
the program, I got the following error (sorry, it's a bit long)
============================================================
In file included from c:/mingw/include/c++/3.2.3/memory:55,
from c:/mingw/include/c++/3.2.3/string:48,
from c:/mingw/include/c++/3.2.3/bits/localefwd.h:49,
from c:/mingw/include/c++/3.2.3/ios:48,
from c:/mingw/include/c++/3.2.3/ostream:45,
from c:/mingw/include/c++/3.2.3/iostream:45,
from hello.cpp:3:
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h: In static member function
`static
void* std::__new_alloc::allocate(unsigned int)':
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h:109: parse error before
`;' token
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h:109: `::<invalid operator>'
undeclared (first use here)
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h: In static member function
`static
void std::__new_alloc::deallocate(void*, unsigned int)':
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h:113: parse error before
`;' token
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h: In member function `void
std::allocator<_Alloc>::construct(_Tp*, const _Tp&)':
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h:700: parse error before
`;' token
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h: In member function `void
std::__allocator<_Tp, _Alloc>::construct(_Tp*, const _Tp&)':
c:/mingw/include/c++/3.2.3/bits/stl_alloc.h:796: parse error before
`;' token
In file included from c:/mingw/include/c++/3.2.3/memory:56,
from c:/mingw/include/c++/3.2.3/string:48,
from c:/mingw/include/c++/3.2.3/bits/localefwd.h:49,
from c:/mingw/include/c++/3.2.3/ios:48,
from c:/mingw/include/c++/3.2.3/ostream:45,
from c:/mingw/include/c++/3.2.3/iostream:45,
from hello.cpp:3:
c:/mingw/include/c++/3.2.3/bits/stl_construct.h: In function `void
std::_Construct(_T1*, const _T2&)':
c:/mingw/include/c++/3.2.3/bits/stl_construct.h:78: parse error before `
static_cast'
c:/mingw/include/c++/3.2.3/bits/stl_construct.h: In function `void
std::_Construct(_T1*)':
c:/mingw/include/c++/3.2.3/bits/stl_construct.h:89: parse error before `
static_cast'
In file included from c:/mingw/include/c++/3.2.3/string:57,
from c:/mingw/include/c++/3.2.3/bits/localefwd.h:49,
from c:/mingw/include/c++/3.2.3/ios:48,
from c:/mingw/include/c++/3.2.3/ostream:45,
from c:/mingw/include/c++/3.2.3/iostream:45,
from hello.cpp:3:
c:/mingw/include/c++/3.2.3/bits/basic_string.tcc: In static member
function
`static std::basic_string<_CharT, _Traits, _Alloc>::_Rep*
std::basic_string<_CharT, _Traits,
_Alloc>::_Rep::_S_create(unsigned int,
const _Alloc&)':
c:/mingw/include/c++/3.2.3/bits/basic_string.tcc:444: parse error
before `)'
token
mingw32-make.exe: *** [hello.o] Error 1
============================================================
I'm really wondering about getting "parse errors"?
So I have some clear questions:
Do "-include mpatrol.h" and "iostream" generally not work together?
(in this case I would have to edit some files ... :-(
Is this a bug, which will be fixed in a next version and I only
have to wait a little bit...?
Is this a kind ob incompatibility of the mingw-version (status:
current) and the mpatrol-version (status: proposed)?
Shall I avoid iostream for all projects in the future?
Have anyone some hints for me?
Thanks in advance
Gerhard