RE: STL problems in GCC 4.1.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx] 
Sent: Tuesday, February 12, 2008 5:20 PM
To: David Arthur
Cc: gcc-help@xxxxxxxxxxx
Subject: Re: STL problems in GCC 4.1.2

On Feb 13, 2008 9:15 AM, David Arthur <darthur@xxxxxxxxxxxxx> 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@xxxxxxxxx]
> Sent: Tuesday, February 12, 2008 4:23 PM
> To: David Arthur
> Cc: gcc-help@xxxxxxxxxxx
> Subject: Re: STL problems in GCC 4.1.2
>
> On 2/12/08, David Arthur <darthur@xxxxxxxxxxxxx> 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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux