Hi, I am porting VC++ application to Linux (Fedora 9) g++ (version GCC 4.3.0). When I compile my code I am getting the following errors:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In instantiation of ‘std::_List_base<LINE, LINE&>’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:417: instantiated from ‘std::list<LINE, LINE&>’
clist.cpp:11: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:292: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:294: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In instantiation of ‘std::_List_base<LINE, LINE&>::_List_impl’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:310: instantiated from ‘std::_List_base<LINE, LINE&>’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:417: instantiated from ‘std::list<LINE, LINE&>’
clist.cpp:11: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:298: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:305: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In instantiation of ‘std::_List_base<LINE, LINE&>’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:417: instantiated from ‘std::list<LINE, LINE&>’
clist.cpp:11: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:324: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:328: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:332: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In instantiation of ‘std::list<LINE, LINE&>’:
clist.cpp:11: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:419: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:448: error: no members matching ‘std::_List_base<LINE, LINE&>::_M_get_Tp_allocator’ in ‘class std::_List_base<LINE, LINE&>’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:449: error: no members matching ‘std::_List_base<LINE, LINE&>::_M_get_Node_allocator’ in ‘class std::_List_base<LINE, LINE&>’
clist.cpp: In member function ‘CLineList& CLineList:
perator=(const CLineList&)’:
clist.cpp:22: error: expected primary-expression before ‘&’ token
clist.cpp: In constructor ‘CLineList::CLineList(int)’:
clist.cpp:39: error: type ‘std::list<LINE, LINE*>’ is not a direct base of ‘CLineList’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In member function ‘size_t std::list<_Tp, _Alloc>::max_size() const [with _Tp = LINE, _Alloc = LINE&]’:
clist.cpp:17: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:769: error: ‘_M_get_Tp_allocator’ was not declared in this scope
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/list.tcc: In member function ‘void std::_List_base<_Tp, _Alloc>::_M_clear() [with _Tp = LINE, _Alloc = LINE&]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:1066: instantiated from ‘void std::list<_Tp, _Alloc>::clear() [with _Tp = LINE, _Alloc = LINE&]’
clist.cpp:19: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/list.tcc:78: error: ‘_M_get_Tp_allocator’ was not declared in this scope
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In member function ‘void std::_List_base<_Tp, _Alloc>::_M_put_node(std::_List_node<_Tp>*) [with _Tp = LINE, _Alloc = LINE&]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/list.tcc:79: instantiated from ‘void std::_List_base<_Tp, _Alloc>::_M_clear() [with _Tp = LINE, _Alloc = LINE&]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:1066: instantiated from ‘void std::list<_Tp, _Alloc>::clear() [with _Tp = LINE, _Alloc = LINE&]’
clist.cpp:19: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:318: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In member function ‘std::_List_node<_Tp>* std::list<_Tp, _Alloc>::_M_create_node(const _Tp&) [with _Tp = LINE, _Alloc = LINE&]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:1341: instantiated from ‘void std::list<_Tp, _Alloc>::_M_insert(std::_List_iterator<_Tp>, const _Tp&) [with _Tp = LINE, _Alloc = LINE&]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:876: instantiated from ‘void std::list<_Tp, _Alloc>:
ush_back(const _Tp&) [with _Tp = LINE, _Alloc = LINE&]’
clist.cpp:22: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:463: error: ‘_M_get_Tp_allocator’ was not declared in this scope
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In constructor ‘std::_List_base<_Tp, _Alloc>::_List_impl::_List_impl() [with _Tp = LINE, _Alloc = LINE&]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:340: instantiated from ‘std::_List_base<_Tp, _Alloc>::_List_base() [with _Tp = LINE, _Alloc = LINE&]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:499: instantiated from ‘std::list<_Tp, _Alloc>::list() [with _Tp = LINE, _Alloc = LINE&]’
clist.cpp:35: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:302: error: ‘LINE&’ is not a class, struct, or union type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h: In member function ‘std::_List_node<_Tp>* std::_List_base<_Tp, _Alloc>::_M_get_node() [with _Tp = LINE, _Alloc = LINE&]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:460: instantiated from ‘std::_List_node<_Tp>* std::list<_Tp, _Alloc>::_M_create_node(const _Tp&) [with _Tp = LINE, _Alloc = LINE&]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:1341: instantiated from ‘void std::list<_Tp, _Alloc>::_M_insert(std::_List_iterator<_Tp>, const _Tp&) [with _Tp = LINE, _Alloc = LINE&]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:876: instantiated from ‘void std::list<_Tp, _Alloc>:
ush_back(const _Tp&) [with _Tp = LINE, _Alloc = LINE&]’
clist.cpp:22: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_list.h:314: error: ‘LINE&’ is not a class, struct, or union type
=======================================================================
Code Sample:
<code>
#include <stdio.h>
#include <iostream>
#include <list>
using namespace std;
struct LINE
{
public:
int x;
};
class CLineList : public std::list<LINE, LINE&>
{
public:
CLineList& operator=(const CLineList& l)
{
if (this != &l)
{
if(max_size() != l.max_size())
{
clear();
if(!l.empty())
{
//push_back(std::list<LINE, LINE*>&l);
push_back((std::list<LINE, LINE&>*) &l);
}
}
}
return *this;
}
CLineList(const CLineList& l)
{
*this = l;
}
CLineList() {};
CLineList(int nBlock): std::list<LINE, LINE*>(nBlock){}
};
</code>
Thanks in advance
-Chris