Compile errors using sstream

View: New views
5 Messages — Rating Filter:   Alert me  

Compile errors using sstream

by Kurt Kohler :: Rate this Message:

| View Threaded | Show Only this Message

When I include <sstream> (which I've done before in other files) I get the following compile errors:

/usr/include/c++/4.1.3/bits/stl_bvector.h: In member function ‘void std::vector<bool, _Alloc>::_M_insert_range(std::_Bit_iterator, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag)’:
/usr/include/c++/4.1.3/bits/stl_bvector.h:542: error: expected unqualified-id before ‘(’ token
/usr/include/c++/4.1.3/bits/stl_bvector.h: In member function ‘void std::vector<bool, _Alloc>::_M_fill_insert(std::_Bit_iterator, size_t, bool)’:
/usr/include/c++/4.1.3/bits/stl_bvector.h:897: error: expected unqualified-id before ‘(’ token
/usr/include/c++/4.1.3/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_fill_insert(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, size_t, const _Tp&)’:
/usr/include/c++/4.1.3/bits/vector.tcc:353: error: expected unqualified-id before ‘(’ token
/usr/include/c++/4.1.3/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_range_insert(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag)’:
/usr/include/c++/4.1.3/bits/vector.tcc:452: error: expected unqualified-id before ‘(’ token
/usr/include/c++/4.1.3/bits/stl_deque.h: In member function ‘void std::_Deque_base<_Tp, _Alloc>::_M_initialize_map(size_t)’:
/usr/include/c++/4.1.3/bits/stl_deque.h:469: error: expected unqualified-id before ‘(’ token
/usr/include/c++/4.1.3/bits/deque.tcc: In member function ‘void std::deque<_Tp, _Alloc>::_M_reallocate_map(size_t, bool)’:
/usr/include/c++/4.1.3/bits/deque.tcc:747: error: expected unqualified-id before ‘(’ token

It looks like the underlying problem is that it can't find std::max.

Any idea what I might be doing wrong?

I can send a bit of my code if it would help.


Re: Compile errors using sstream

by Jonathan Wakely-4 :: Rate this Message:

| View Threaded | Show Only this Message

On 26/01/2008, Kurt Kohler <kohler@...> wrote:
>
> When I include <sstream> (which I've done before in other files) I get the
> following compile errors:
[snip]
> It looks like the underlying problem is that it can't find std::max.
>
> Any idea what I might be doing wrong?
>
> I can send a bit of my code if it would help.

Only a bit probably won't help, as it might not show the part that
causes the error.  Can you produce a small testcase in a single file
that still produces the error?

Jon

Re: Compile errors using sstream

by Joe Buck :: Rate this Message:

| View Threaded | Show Only this Message

On Sat, Jan 26, 2008 at 12:53:34AM +0000, Jonathan Wakely wrote:

> On 26/01/2008, Kurt Kohler <kohler@...> wrote:
> >
> > When I include <sstream> (which I've done before in other files) I get the
> > following compile errors:
> [snip]
> > It looks like the underlying problem is that it can't find std::max.
> >
> > Any idea what I might be doing wrong?
> >
> > I can send a bit of my code if it would help.
>
> Only a bit probably won't help, as it might not show the part that
> causes the error.  Can you produce a small testcase in a single file
> that still produces the error?

You might be defining a macro that clashes with something in the headers;
"max" for example.

Re: Compile errors using sstream

by Kurt Kohler :: Rate this Message:

| View Threaded | Show Only this Message

Joe Buck wrote:

> On Sat, Jan 26, 2008 at 12:53:34AM +0000, Jonathan Wakely wrote:
>  
>> On 26/01/2008, Kurt Kohler <kohler@...> wrote:
>>    
>>> When I include <sstream> (which I've done before in other files) I get the
>>> following compile errors:
>>>      
>> [snip]
>>    
>>> It looks like the underlying problem is that it can't find std::max.
>>>
>>> Any idea what I might be doing wrong?
>>>
>>> I can send a bit of my code if it would help.
>>>      
>> Only a bit probably won't help, as it might not show the part that
>> causes the error.  Can you produce a small testcase in a single file
>> that still produces the error?
>>    
>
> You might be defining a macro that clashes with something in the headers;
> "max" for example.
>
>
>  
Ah ha! I think that's it! I'm modifying old code (not mine!) and it  
does define max and min macros.

I'll fix it and let you know what happens.

Thanks for the help!

Kurt Kohler


Re: Compile errors using sstream

by Kurt Kohler :: Rate this Message:

| View Threaded | Show Only this Message

Joe Buck wrote:

> On Sat, Jan 26, 2008 at 12:53:34AM +0000, Jonathan Wakely wrote:
>  
>> On 26/01/2008, Kurt Kohler <kohler@...> wrote:
>>    
>>> When I include <sstream> (which I've done before in other files) I get the
>>> following compile errors:
>>>      
>> [snip]
>>    
>>> It looks like the underlying problem is that it can't find std::max.
>>>
>>> Any idea what I might be doing wrong?
>>>
>>> I can send a bit of my code if it would help.
>>>      
>> Only a bit probably won't help, as it might not show the part that
>> causes the error.  Can you produce a small testcase in a single file
>> that still produces the error?
>>    
>
> You might be defining a macro that clashes with something in the headers;
> "max" for example.
>
>
>  
That was it. It turns out the min and max macros weren't even being used
any more, so I just deleted them.

Thanks again.