public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* STL problems in GCC 4.1.2
@ 2008-02-12 22:11 David Arthur
  2008-02-12 22:23 ` Tom Browder
  0 siblings, 1 reply; 14+ messages in thread
From: David Arthur @ 2008-02-12 22:11 UTC (permalink / raw)
  To: gcc-help

Hello all,

I have searched archives for info regarding this, but didn't find
anything...
I am trying to compile an app under gcc 4.1.2 and I get _loads_ of STL
errors, relating to templates in STL headers that are unhappy. The strange
thing is that all compiles beautifully under gcc 3.3.3! I have found that
some of the errors can be eliminated by simply rearranging the #include
directives for my many header files, or in some cases, by throwing a
#include <list> (or <string>, <vector> etc.) into my include list.
Does anyone know why this is happening?
I use a large number of included header files and this is a rather large
project (which is why I haven't included any code).

Any help anyone can provide would be greatly appreciated!

Thank you,
Dave

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: STL problems in GCC 4.1.2
  2008-02-12 22:11 STL problems in GCC 4.1.2 David Arthur
@ 2008-02-12 22:23 ` Tom Browder
  2008-02-12 22:46   ` David Arthur
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Browder @ 2008-02-12 22:23 UTC (permalink / raw)
  To: David Arthur; +Cc: gcc-help

On 2/12/08, David Arthur <darthur@tantacomm.com> wrote:
...
> I am trying to compile an app under gcc 4.1.2 and I get _loads_ of STL
> errors, relating to templates in STL headers that are unhappy. The strange
> thing is that all compiles beautifully under gcc 3.3.3! I have found that

Lots of changes, and tightening of user code required, from 3.3.3 to 4.1.2.

How about posting a couple of the error messages so we can see what
kinds of errors you're talking about.

-Tom

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: STL problems in GCC 4.1.2
  2008-02-12 22:23 ` Tom Browder
@ 2008-02-12 22:46   ` David Arthur
  2008-02-12 23:20     ` James Tebneff
  0 siblings, 1 reply; 14+ messages in thread
From: David Arthur @ 2008-02-12 22:46 UTC (permalink / raw)
  To: gcc-help

Well, here goes. I'll snip a chunk out of the middle to shorten the post!

c++ -I/home/dart/src/dartnms/include -I/home/dart/src/plugappsdk/include -I/home/dart/src/dartnms/plugins/dartnmsbase/include -I/home/dart/src/lib -D_LINUX_ -Wno-deprecated -c -fpermissive -o /home/dart/src/dartnms/obj/main.o /home/dart/src/dartnms/src/main.cpp
/usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/stl_tree.h:791: error: no ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’ member function declared in class ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’
/usr/include/c++/4.1.2/bits/stl_tree.h:791: error: template definition of non-template ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’
/usr/include/c++/4.1.2/bits/stl_tree.h: In member function ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’:
/usr/include/c++/4.1.2/bits/stl_tree.h:797: error: ‘_M_impl’ was not declared in this scope
/usr/include/c++/4.1.2/bits/stl_tree.h: At global scope:
/usr/include/c++/4.1.2/bits/stl_tree.h:813: error: ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert’ is not a static member of ‘class std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’
/usr/include/c++/4.1.2/bits/stl_tree.h:813: error: template definition of non-template ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert’

[...snip...]

/usr/include/c++/4.1.2/bits/stl_tree.h:1485: error: ‘__x’ was not declared in this scope
/usr/include/c++/4.1.2/bits/stl_map.h: At global scope:
/usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected unqualified-id before ‘else’
make: *** [/home/dart/src/dartnms/obj/main.o] Error 1

Thanks, Dave

-----Original Message-----
From: Tom Browder [mailto:tom.browder@gmail.com] 
Sent: Tuesday, February 12, 2008 4:23 PM
To: David Arthur
Cc: gcc-help@gcc.gnu.org
Subject: Re: STL problems in GCC 4.1.2

On 2/12/08, David Arthur <darthur@tantacomm.com> wrote:
...
> I am trying to compile an app under gcc 4.1.2 and I get _loads_ of STL
> errors, relating to templates in STL headers that are unhappy. The strange
> thing is that all compiles beautifully under gcc 3.3.3! I have found that

Lots of changes, and tightening of user code required, from 3.3.3 to 4.1.2.

How about posting a couple of the error messages so we can see what
kinds of errors you're talking about.

-Tom

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: STL problems in GCC 4.1.2
  2008-02-12 22:46   ` David Arthur
@ 2008-02-12 23:20     ` James Tebneff
  2008-02-14 22:23       ` David Arthur
  2008-02-21 18:14       ` David Arthur
  0 siblings, 2 replies; 14+ messages in thread
From: James Tebneff @ 2008-02-12 23:20 UTC (permalink / raw)
  To: David Arthur; +Cc: gcc-help

On Feb 13, 2008 9:15 AM, David Arthur <darthur@tantacomm.com> wrote:
> Well, here goes. I'll snip a chunk out of the middle to shorten the post!
>
> c++ -I/home/dart/src/dartnms/include -I/home/dart/src/plugappsdk/include -I/home/dart/src/dartnms/plugins/dartnmsbase/include -I/home/dart/src/lib -D_LINUX_ -Wno-deprecated -c -fpermissive -o /home/dart/src/dartnms/obj/main.o /home/dart/src/dartnms/src/main.cpp
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected unqualified-id before ‘else’
> /usr/include/c++/4.1.2/bits/stl_tree.h:791: error: no ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’ member function declared in class ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’
> /usr/include/c++/4.1.2/bits/stl_tree.h:791: error: template definition of non-template ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’
> /usr/include/c++/4.1.2/bits/stl_tree.h: In member function ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’:
> /usr/include/c++/4.1.2/bits/stl_tree.h:797: error: ‘_M_impl’ was not declared in this scope
> /usr/include/c++/4.1.2/bits/stl_tree.h: At global scope:
> /usr/include/c++/4.1.2/bits/stl_tree.h:813: error: ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert’ is not a static member of ‘class std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’
> /usr/include/c++/4.1.2/bits/stl_tree.h:813: error: template definition of non-template ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert’
>
> [...snip...]
>
> /usr/include/c++/4.1.2/bits/stl_tree.h:1485: error: ‘__x’ was not declared in this scope
> /usr/include/c++/4.1.2/bits/stl_map.h: At global scope:
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected unqualified-id before ‘else’
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected unqualified-id before ‘else’
> make: *** [/home/dart/src/dartnms/obj/main.o] Error 1
>
> Thanks, Dave
>
>
> -----Original Message-----
> From: Tom Browder [mailto:tom.browder@gmail.com]
> Sent: Tuesday, February 12, 2008 4:23 PM
> To: David Arthur
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: STL problems in GCC 4.1.2
>
> On 2/12/08, David Arthur <darthur@tantacomm.com> wrote:
> ...
> > I am trying to compile an app under gcc 4.1.2 and I get _loads_ of STL
> > errors, relating to templates in STL headers that are unhappy. The strange
> > thing is that all compiles beautifully under gcc 3.3.3! I have found that
>
> Lots of changes, and tightening of user code required, from 3.3.3 to 4.1.2.
>
> How about posting a couple of the error messages so we can see what
> kinds of errors you're talking about.
>
> -Tom
>
>


Like Tom said you need to explicitly include header files for all STL
constructs you use and indeed for any function you use from any header
file.

Gcc 4.x.x has made these rules very strict.
You are compiling with -Wall and -Werror right?


I would worry about using -fpermissive can you remove this option and
fix any problems that may arise?

Regards,
JT

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: STL problems in GCC 4.1.2
  2008-02-12 23:20     ` James Tebneff
@ 2008-02-14 22:23       ` David Arthur
  2008-02-21 18:14       ` David Arthur
  1 sibling, 0 replies; 14+ messages in thread
From: David Arthur @ 2008-02-14 22:23 UTC (permalink / raw)
  To: gcc-help

Thanks much for your help!
I have made sure that I am including each STL header that I use anything from, in the source or header file where it is used.
I am now compiling with -Wall and -Werror, and have removed -fpermissive's.
Here are some of the errors I am still seeing:

c++ -I/home/dart/src/dartnms/include -I/home/dart/src/plugappsdk/include -I/home/dart/src/dartnms/plugins/dartnmsbase/include -I/home/dart/src/lib -D_LINUX_ -Wno-deprecated -Wall -Werror -c -o /home/dart/src/dartnms/obj/dartnms.o /home/dart/src/dartnms/src/dartnms.cpp
/usr/include/c++/4.1.2/bits/stl_list.h:297: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_list.h:297: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_list.h:297: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/stl_list.h:300: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/list.tcc:69: error: no ‘void std::_List_base<_Tp, _Alloc>::_M_clear()’ member function declared in class ‘std::_List_base<_Tp, _Alloc>’
/usr/include/c++/4.1.2/bits/list.tcc:69: error: template definition of non-template ‘void std::_List_base<_Tp, _Alloc>::_M_clear()’
/usr/include/c++/4.1.2/bits/list.tcc: In member function ‘void std::_List_base<_Tp, _Alloc>::_M_clear()’:
/usr/include/c++/4.1.2/bits/list.tcc:77: error: there are no arguments to ‘_M_get_Tp_allocator’ that depend on a template parameter, so a declaration of ‘_M_get_Tp_allocator’ must be available
/usr/include/c++/4.1.2/bits/list.tcc:77: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/include/c++/4.1.2/bits/stl_list.h: At global scope:
/usr/include/c++/4.1.2/bits/stl_list.h: In instantiation of ‘std::list<AppTimer*, std::allocator<AppTimer*> >’:
/home/dart/src/plugappsdk/include/appTimer.h:171:   instantiated from here
/usr/include/c++/4.1.2/bits/stl_list.h:406: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:410: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:411: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:412: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:413: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:433: error: no members matching ‘std::_List_base<AppTimer*, std::allocator<AppTimer*> >::_M_impl’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:434: error: no members matching ‘std::_List_base<AppTimer*, std::allocator<AppTimer*> >::_M_put_node’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:435: error: no members matching ‘std::_List_base<AppTimer*, std::allocator<AppTimer*> >::_M_get_node’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:436: error: no members matching ‘std::_List_base<AppTimer*, std::allocator<AppTimer*> >::_M_get_Tp_allocator’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:683: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:691: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:699: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:711: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_vector.h:78: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_vector.h:78: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_vector.h:78: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/stl_bvector.h:359: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_bvector.h:359: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_bvector.h:359: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/stl_list.h: In instantiation of ‘std::list<FileIniEntry*, std::allocator<FileIniEntry*> >’:
/home/dart/src/plugappsdk/include/fileConfig.h:113:   instantiated from here
/usr/include/c++/4.1.2/bits/stl_list.h:406: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:410: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:411: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:412: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:413: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:433: error: no members matching ‘std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >::_M_impl’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:434: error: no members matching ‘std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >::_M_put_node’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:435: error: no members matching ‘std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >::_M_get_node’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:436: error: no members matching ‘std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >::_M_get_Tp_allocator’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:683: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:691: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:699: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:711: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h: In instantiation of ‘std::list<FileConfEntry*, std::allocator<FileConfEntry*> >’:

[snip...]

It looks like repeats of the above for each object module involved that uses STL functionality.

Any ideas?

Thanks again, Dave


-----Original Message-----
From: James Tebneff [mailto:tebneff@gmail.com] 
Sent: Tuesday, February 12, 2008 5:20 PM
To: David Arthur
Cc: gcc-help@gcc.gnu.org
Subject: Re: STL problems in GCC 4.1.2

On Feb 13, 2008 9:15 AM, David Arthur <darthur@tantacomm.com> wrote:
> Well, here goes. I'll snip a chunk out of the middle to shorten the post!
>
> c++ -I/home/dart/src/dartnms/include -I/home/dart/src/plugappsdk/include -I/home/dart/src/dartnms/plugins/dartnmsbase/include -I/home/dart/src/lib -D_LINUX_ -Wno-deprecated -c -fpermissive -o /home/dart/src/dartnms/obj/main.o /home/dart/src/dartnms/src/main.cpp
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected unqualified-id before ‘else’
> /usr/include/c++/4.1.2/bits/stl_tree.h:791: error: no ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’ member function declared in class ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’
> /usr/include/c++/4.1.2/bits/stl_tree.h:791: error: template definition of non-template ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’
> /usr/include/c++/4.1.2/bits/stl_tree.h: In member function ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’:
> /usr/include/c++/4.1.2/bits/stl_tree.h:797: error: ‘_M_impl’ was not declared in this scope
> /usr/include/c++/4.1.2/bits/stl_tree.h: At global scope:
> /usr/include/c++/4.1.2/bits/stl_tree.h:813: error: ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert’ is not a static member of ‘class std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’
> /usr/include/c++/4.1.2/bits/stl_tree.h:813: error: template definition of non-template ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert’
>
> [...snip...]
>
> /usr/include/c++/4.1.2/bits/stl_tree.h:1485: error: ‘__x’ was not declared in this scope
> /usr/include/c++/4.1.2/bits/stl_map.h: At global scope:
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected unqualified-id before ‘else’
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected unqualified-id before ‘else’
> make: *** [/home/dart/src/dartnms/obj/main.o] Error 1
>
> Thanks, Dave
>
>
> -----Original Message-----
> From: Tom Browder [mailto:tom.browder@gmail.com]
> Sent: Tuesday, February 12, 2008 4:23 PM
> To: David Arthur
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: STL problems in GCC 4.1.2
>
> On 2/12/08, David Arthur <darthur@tantacomm.com> wrote:
> ...
> > I am trying to compile an app under gcc 4.1.2 and I get _loads_ of STL
> > errors, relating to templates in STL headers that are unhappy. The strange
> > thing is that all compiles beautifully under gcc 3.3.3! I have found that
>
> Lots of changes, and tightening of user code required, from 3.3.3 to 4.1.2.
>
> How about posting a couple of the error messages so we can see what
> kinds of errors you're talking about.
>
> -Tom
>
>


Like Tom said you need to explicitly include header files for all STL
constructs you use and indeed for any function you use from any header
file.

Gcc 4.x.x has made these rules very strict.
You are compiling with -Wall and -Werror right?


I would worry about using -fpermissive can you remove this option and
fix any problems that may arise?

Regards,
JT

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: STL problems in GCC 4.1.2
  2008-02-12 23:20     ` James Tebneff
  2008-02-14 22:23       ` David Arthur
@ 2008-02-21 18:14       ` David Arthur
       [not found]         ` <C3E329D4.1C1C%eljay@adobe.com>
  1 sibling, 1 reply; 14+ messages in thread
From: David Arthur @ 2008-02-21 18:14 UTC (permalink / raw)
  To: tebneff; +Cc: gcc-help

Hello all,

I am still unable to find the source of these STL errors.
I am including the appropriate STL headers for each use of STL functionality that occurs in my project, but still loads of errors.
here are some of them:

c++ -I/home/dart/src/dartnms/include -I/home/dart/src/plugappsdk/include 
c++ -I/home/dart/src/dartnms/plugins/dartnmsbase/include 
c++ -I/home/dart/src/lib -D_LINUX_ -Wno-deprecated -Wall -Werror -c -o 
c++ /home/dart/src/dartnms/obj/dartnms.o 
c++ /home/dart/src/dartnms/src/dartnms.cpp
/usr/include/c++/4.1.2/bits/stl_list.h:297: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_list.h:297: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_list.h:297: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/stl_list.h:300: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/list.tcc:69: error: no ‘void std::_List_base<_Tp, _Alloc>::_M_clear()’ member function declared in class ‘std::_List_base<_Tp, _Alloc>’
/usr/include/c++/4.1.2/bits/list.tcc:69: error: template definition of non-template ‘void std::_List_base<_Tp, _Alloc>::_M_clear()’
/usr/include/c++/4.1.2/bits/list.tcc: In member function ‘void std::_List_base<_Tp, _Alloc>::_M_clear()’:
/usr/include/c++/4.1.2/bits/list.tcc:77: error: there are no arguments to ‘_M_get_Tp_allocator’ that depend on a template parameter, so a declaration of ‘_M_get_Tp_allocator’ must be available
/usr/include/c++/4.1.2/bits/list.tcc:77: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/include/c++/4.1.2/bits/stl_list.h: At global scope:
/usr/include/c++/4.1.2/bits/stl_list.h: In instantiation of ‘std::list<AppTimer*, std::allocator<AppTimer*> >’:
/home/dart/src/plugappsdk/include/appTimer.h:171:   instantiated from here
/usr/include/c++/4.1.2/bits/stl_list.h:406: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:410: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:411: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:412: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:413: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:433: error: no members matching ‘std::_List_base<AppTimer*, std::allocator<AppTimer*> >::_M_impl’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:434: error: no members matching ‘std::_List_base<AppTimer*, std::allocator<AppTimer*> >::_M_put_node’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:435: error: no members matching ‘std::_List_base<AppTimer*, std::allocator<AppTimer*> >::_M_get_node’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:436: error: no members matching ‘std::_List_base<AppTimer*, std::allocator<AppTimer*> >::_M_get_Tp_allocator’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:683: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:691: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:699: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:711: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<AppTimer*, std::allocator<AppTimer*> >’
/usr/include/c++/4.1.2/bits/stl_vector.h:78: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_vector.h:78: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_vector.h:78: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/stl_bvector.h:359: error: expected identifier before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_bvector.h:359: error: expected unqualified-id before ‘}’ token
/usr/include/c++/4.1.2/bits/stl_bvector.h:359: error: expected unqualified-id before ‘else’
/usr/include/c++/4.1.2/bits/stl_list.h: In instantiation of ‘std::list<FileIniEntry*, std::allocator<FileIniEntry*> >’:
/home/dart/src/plugappsdk/include/fileConfig.h:113:   instantiated from here
/usr/include/c++/4.1.2/bits/stl_list.h:406: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:410: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:411: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:412: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:413: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:433: error: no members matching ‘std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >::_M_impl’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:434: error: no members matching ‘std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >::_M_put_node’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:435: error: no members matching ‘std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >::_M_get_node’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:436: error: no members matching ‘std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >::_M_get_Tp_allocator’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:683: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:691: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:699: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h:711: error: no type named ‘_Tp_alloc_type’ in ‘class std::_List_base<FileIniEntry*, std::allocator<FileIniEntry*> >’
/usr/include/c++/4.1.2/bits/stl_list.h: In instantiation of ‘std::list<FileConfEntry*, std::allocator<FileConfEntry*> >’:

[snip...]

Can anyone give any ideas here?

Thanks for your help,
Dave

-----Original Message-----
From: James Tebneff [mailto:tebneff@gmail.com] 
Sent: Tuesday, February 12, 2008 5:20 PM
To: David Arthur
Cc: gcc-help@gcc.gnu.org
Subject: Re: STL problems in GCC 4.1.2

On Feb 13, 2008 9:15 AM, David Arthur <darthur@tantacomm.com> wrote:
> Well, here goes. I'll snip a chunk out of the middle to shorten the post!
>
> c++ -I/home/dart/src/dartnms/include -I/home/dart/src/plugappsdk/include -I/home/dart/src/dartnms/plugins/dartnmsbase/include -I/home/dart/src/lib -D_LINUX_ -Wno-deprecated -c -fpermissive -o /home/dart/src/dartnms/obj/main.o /home/dart/src/dartnms/src/main.cpp
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_tree.h:330: error: expected unqualified-id before ‘else’
> /usr/include/c++/4.1.2/bits/stl_tree.h:791: error: no ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’ member function declared in class ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’
> /usr/include/c++/4.1.2/bits/stl_tree.h:791: error: template definition of non-template ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’
> /usr/include/c++/4.1.2/bits/stl_tree.h: In member function ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)’:
> /usr/include/c++/4.1.2/bits/stl_tree.h:797: error: ‘_M_impl’ was not declared in this scope
> /usr/include/c++/4.1.2/bits/stl_tree.h: At global scope:
> /usr/include/c++/4.1.2/bits/stl_tree.h:813: error: ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert’ is not a static member of ‘class std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>’
> /usr/include/c++/4.1.2/bits/stl_tree.h:813: error: template definition of non-template ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert’
>
> [...snip...]
>
> /usr/include/c++/4.1.2/bits/stl_tree.h:1485: error: ‘__x’ was not declared in this scope
> /usr/include/c++/4.1.2/bits/stl_map.h: At global scope:
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_map.h:127: error: expected unqualified-id before ‘else’
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected identifier before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected unqualified-id before ‘}’ token
> /usr/include/c++/4.1.2/bits/stl_multimap.h:142: error: expected unqualified-id before ‘else’
> make: *** [/home/dart/src/dartnms/obj/main.o] Error 1
>
> Thanks, Dave
>
>
> -----Original Message-----
> From: Tom Browder [mailto:tom.browder@gmail.com]
> Sent: Tuesday, February 12, 2008 4:23 PM
> To: David Arthur
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: STL problems in GCC 4.1.2
>
> On 2/12/08, David Arthur <darthur@tantacomm.com> wrote:
> ...
> > I am trying to compile an app under gcc 4.1.2 and I get _loads_ of STL
> > errors, relating to templates in STL headers that are unhappy. The strange
> > thing is that all compiles beautifully under gcc 3.3.3! I have found that
>
> Lots of changes, and tightening of user code required, from 3.3.3 to 4.1.2.
>
> How about posting a couple of the error messages so we can see what
> kinds of errors you're talking about.
>
> -Tom
>
>


Like Tom said you need to explicitly include header files for all STL
constructs you use and indeed for any function you use from any header
file.

Gcc 4.x.x has made these rules very strict.
You are compiling with -Wall and -Werror right?


I would worry about using -fpermissive can you remove this option and
fix any problems that may arise?

Regards,
JT

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: STL problems in GCC 4.1.2
       [not found]         ` <C3E329D4.1C1C%eljay@adobe.com>
@ 2008-02-21 19:27           ` David Arthur
  2008-02-21 19:43             ` Eljay Love-Jensen
  0 siblings, 1 reply; 14+ messages in thread
From: David Arthur @ 2008-02-21 19:27 UTC (permalink / raw)
  To: 'Eljay Love-Jensen'; +Cc: gcc-help

Hi Eljay,

"c++ --version" gives the following:

c++ (GCC) 4.1.2 20070115 (prerelease) (SUSE Linux)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The "c++ -v --help 2>&1 > cmd.out" results in:

Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2
--enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --program-suffix=
--enable-version-specific-runtime-libs --without-system-libunwind
--with-cpu=generic --host=i586-suse-linux
Thread model: posix
gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)

 /usr/lib/gcc/i586-suse-linux/4.1.2/cc1 -quiet -v help-dummy -quiet
-dumpbase help-dummy -mtune=generic -auxbase help-dummy -version --help -o
/tmp/ccaeWc0t.s

 /usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/bin/as -V
-Qy --help -o /tmp/cc29hxFQ.o /tmp/ccaeWc0t.s
GNU assembler version 2.16.91.0.5 (i586-suse-linux) using BFD version
2.16.91.0.5 20051219 (SUSE Linux)

 /usr/lib/gcc/i586-suse-linux/4.1.2/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 --help
/usr/lib/gcc/i586-suse-linux/4.1.2/../../../crt1.o
/usr/lib/gcc/i586-suse-linux/4.1.2/../../../crti.o
/usr/lib/gcc/i586-suse-linux/4.1.2/crtbegin.o
-L/usr/lib/gcc/i586-suse-linux/4.1.2 -L/usr/lib/gcc/i586-suse-linux/4.1.2
-L/usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/lib
-L/usr/lib/gcc/i586-suse-linux/4.1.2/../../.. /tmp/cc29hxFQ.o -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed /usr/lib/gcc/i586-suse-linux/4.1.2/crtend.o
/usr/lib/gcc/i586-suse-linux/4.1.2/../../../crtn.o

(I included the "> cmd.out" as the help spews a long output of all options
that are language independent into a file then.)

Any ideas?

Thanks for your help!
Dave

-----Original Message-----
From: Eljay Love-Jensen [mailto:eljay@adobe.com] 
Sent: Thursday, February 21, 2008 1:15 PM
To: David Arthur
Subject: Re: STL problems in GCC 4.1.2

Hi David,

What does this command produce:

c++ --version

What does this command produce:

c++ -v --help 2>&1

Sincerely,
--Eljay

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: STL problems in GCC 4.1.2
  2008-02-21 19:27           ` David Arthur
@ 2008-02-21 19:43             ` Eljay Love-Jensen
  2008-02-21 20:08               ` David Arthur
  0 siblings, 1 reply; 14+ messages in thread
From: Eljay Love-Jensen @ 2008-02-21 19:43 UTC (permalink / raw)
  To: David Arthur; +Cc: GCC-help

Hi David,

Hmmm.

It says that you are using a pre-release.  Can you get a non-pre-release
build of 4.1.2?  Probably doesn't matter.

It looks like it was built with "../configure", which is not a supported way
to build GCC.  That could be causing problems.

It looks like it is using the correct cc1 and collect2.

What errors does this short C++ "foo.cpp" program produce?

------------------------------------------------------------
// c++ -std=c++98 -Wall -Wextra -pedantic -o foo foo.cpp
#include <iostream>
#include <list>
#include <string>
using std::cout;
using std::endl;
using std::list;
using std::string;
int main()
{
  typedef list<string> MyList;
  MyList myList;
  myList.push_back("hello");
  myList.push_back("world");
  myList.push_back("goodnight");
  myList.push_back("moon");
  for(MyList::iterator i = myList.begin(); i != myList.end(); ++i)
  {
    cout << *i << endl;
  }
}
------------------------------------------------------------

--Eljay


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: STL problems in GCC 4.1.2
  2008-02-21 19:43             ` Eljay Love-Jensen
@ 2008-02-21 20:08               ` David Arthur
  2008-02-21 20:17                 ` Eljay Love-Jensen
  2008-02-25 14:53                 ` Philipp Thomas
  0 siblings, 2 replies; 14+ messages in thread
From: David Arthur @ 2008-02-21 20:08 UTC (permalink / raw)
  To: 'Eljay Love-Jensen'; +Cc: 'GCC-help'

Hi Eljay,

The GCC I am using is what was included in the SuSE Linux Enterprise Server
10 installation on the machine I am compiling with, so I am not sure how it
was built.

The program you gave was entered verbatim, and it compiles with no errors
and runs nicely. :)

Thanks for your quick replies!
Dave

-----Original Message-----
From: Eljay Love-Jensen [mailto:eljay@adobe.com] 
Sent: Thursday, February 21, 2008 1:43 PM
To: David Arthur
Cc: GCC-help
Subject: Re: STL problems in GCC 4.1.2

Hi David,

Hmmm.

It says that you are using a pre-release.  Can you get a non-pre-release
build of 4.1.2?  Probably doesn't matter.

It looks like it was built with "../configure", which is not a supported way
to build GCC.  That could be causing problems.

It looks like it is using the correct cc1 and collect2.

What errors does this short C++ "foo.cpp" program produce?

------------------------------------------------------------
// c++ -std=c++98 -Wall -Wextra -pedantic -o foo foo.cpp
#include <iostream>
#include <list>
#include <string>
using std::cout;
using std::endl;
using std::list;
using std::string;
int main()
{
  typedef list<string> MyList;
  MyList myList;
  myList.push_back("hello");
  myList.push_back("world");
  myList.push_back("goodnight");
  myList.push_back("moon");
  for(MyList::iterator i = myList.begin(); i != myList.end(); ++i)
  {
    cout << *i << endl;
  }
}
------------------------------------------------------------

--Eljay


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: STL problems in GCC 4.1.2
  2008-02-21 20:08               ` David Arthur
@ 2008-02-21 20:17                 ` Eljay Love-Jensen
  2008-02-21 22:59                   ` Tom Browder
  2008-02-21 22:59                   ` Tom Browder
  2008-02-25 14:53                 ` Philipp Thomas
  1 sibling, 2 replies; 14+ messages in thread
From: Eljay Love-Jensen @ 2008-02-21 20:17 UTC (permalink / raw)
  To: David Arthur; +Cc: GCC-help

Hi Dave,

> The program you gave was entered verbatim, and it compiles with no errors
> and runs nicely. :)

That indicates to me that the GCC 4.1.2 Standard C++ Library (including the
STL) is probably working correctly, and something else is causing things to
go awry.

One possible culprit is that some header file somewhere (not one of the GCC
4.1.2 ones) is introducing a #define identifier that is wreaking havoc on
later #include directives due to identifier collision.  You may be able to
use g++ -E to assess where that is occurring, if it is indeed occurring.
[This is my first, best guess.]

Another possible culprit is a malformed header file.  For example, a header
with...

class Foo { }

... (notice the missing semicolon) can cause problems for subsequent headers
and/or code.

Or a header that does something naughty like...

#ifdef __cplusplus
extern "C" {
#endif
#include <this.h>
#include <that.h>
#include <theother.h>
#include <iostream>
#ifdef __cplusplus
}
#endif

... which can bollix up the embedded headers.

Or using the "old" C++ headers, like #include <iostream.h> instead of
#include <iostream> can cause problems, sometimes.

Also look for code that may not be std:: namespace savvy.

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: STL problems in GCC 4.1.2
  2008-02-21 20:17                 ` Eljay Love-Jensen
  2008-02-21 22:59                   ` Tom Browder
@ 2008-02-21 22:59                   ` Tom Browder
  2008-02-22  9:08                     ` Tom Browder
  1 sibling, 1 reply; 14+ messages in thread
From: Tom Browder @ 2008-02-21 22:59 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: David Arthur, GCC-help

On 2/21/08, Eljay Love-Jensen <eljay@adobe.com> wrote:
> Hi Dave,
>
> > The program you gave was entered verbatim, and it compiles with no errors
> > and runs nicely. :)
>
> That indicates to me that the GCC 4.1.2 Standard C++ Library (including the
> STL) is probably working correctly, and something else is causing things to
> go awry.
>
> One possible culprit is that some header file somewhere (not one of the GCC
> 4.1.2 ones) is introducing a #define identifier that is wreaking havoc on
> later #include directives due to identifier collision.  You may be able to
> use g++ -E to assess where that is occurring, if it is indeed occurring.
> [This is my first, best guess.]
...

And don't forget Scott Meyers's admonitions to NEVER use a using
declaration inside a header or in a source file before any #include's.

-Tom

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: STL problems in GCC 4.1.2
  2008-02-21 20:17                 ` Eljay Love-Jensen
@ 2008-02-21 22:59                   ` Tom Browder
  2008-02-21 22:59                   ` Tom Browder
  1 sibling, 0 replies; 14+ messages in thread
From: Tom Browder @ 2008-02-21 22:59 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: David Arthur, GCC-help

On 2/21/08, Eljay Love-Jensen <eljay@adobe.com> wrote:
> Hi Dave,
>
> > The program you gave was entered verbatim, and it compiles with no errors
> > and runs nicely. :)
>
> That indicates to me that the GCC 4.1.2 Standard C++ Library (including the
> STL) is probably working correctly, and something else is causing things to
> go awry.
>
> One possible culprit is that some header file somewhere (not one of the GCC
> 4.1.2 ones) is introducing a #define identifier that is wreaking havoc on
> later #include directives due to identifier collision.  You may be able to
> use g++ -E to assess where that is occurring, if it is indeed occurring.
> [This is my first, best guess.]
...

And don't forget Scott Meyers's admonitions to NEVER use a using
declaration inside a header or in a source file before any #include's.

-Tom

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: STL problems in GCC 4.1.2
  2008-02-21 22:59                   ` Tom Browder
@ 2008-02-22  9:08                     ` Tom Browder
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Browder @ 2008-02-22  9:08 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: David Arthur, GCC-help

On 2/21/08, Eljay Love-Jensen <eljay@adobe.com> wrote:
> Hi Dave,
>
> > The program you gave was entered verbatim, and it compiles with no errors
> > and runs nicely. :)
>
> That indicates to me that the GCC 4.1.2 Standard C++ Library (including the
> STL) is probably working correctly, and something else is causing things to
> go awry.
>
> One possible culprit is that some header file somewhere (not one of the GCC
> 4.1.2 ones) is introducing a #define identifier that is wreaking havoc on
> later #include directives due to identifier collision.  You may be able to
> use g++ -E to assess where that is occurring, if it is indeed occurring.
> [This is my first, best guess.]
...

And don't forget Scott Meyers's admonitions to NEVER use a using
declaration inside a header or in a source file before any #include's.

-Tom

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: STL problems in GCC 4.1.2
  2008-02-21 20:08               ` David Arthur
  2008-02-21 20:17                 ` Eljay Love-Jensen
@ 2008-02-25 14:53                 ` Philipp Thomas
  1 sibling, 0 replies; 14+ messages in thread
From: Philipp Thomas @ 2008-02-25 14:53 UTC (permalink / raw)
  To: gcc-help

Hi David,

* David Arthur (darthur@tantacomm.com) [20080221 21:08]:

> The GCC I am using is what was included in the SuSE Linux Enterprise Server
> 10 installation on the machine I am compiling with, so I am not sure how it
> was built.

Could you make the preprocessed source of one of the failing sources
available or send it to me? Preprocessed source means that you add
-save-temps to the compiler flags and either make available or send me the
resulting .ii file. Maybe I can help in identifying the culprit.

Philipp

-- 
Software engineer
R&D
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuremberg, GERMANY
 

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-02-25 13:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-12 22:11 STL problems in GCC 4.1.2 David Arthur
2008-02-12 22:23 ` Tom Browder
2008-02-12 22:46   ` David Arthur
2008-02-12 23:20     ` James Tebneff
2008-02-14 22:23       ` David Arthur
2008-02-21 18:14       ` David Arthur
     [not found]         ` <C3E329D4.1C1C%eljay@adobe.com>
2008-02-21 19:27           ` David Arthur
2008-02-21 19:43             ` Eljay Love-Jensen
2008-02-21 20:08               ` David Arthur
2008-02-21 20:17                 ` Eljay Love-Jensen
2008-02-21 22:59                   ` Tom Browder
2008-02-21 22:59                   ` Tom Browder
2008-02-22  9:08                     ` Tom Browder
2008-02-25 14:53                 ` Philipp Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).