LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-09-2009, 02:24 PM   #1
linux_chris
LQ Newbie
 
Registered: Dec 2008
Posts: 18

Rep: Reputation: 0
Porting VC++ to Linux g++


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

Last edited by linux_chris; 02-09-2009 at 02:34 PM.
 
Old 02-10-2009, 08:49 AM   #2
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,051

Rep: Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100
Quote:
Originally Posted by linux_chris View Post
std::list<LINE, LINE&>
That was a rather long post in which to find a question about the second template arg for std::list

I don't know the answer, but I think I can clarify some of the questions.

What can you use as a second template arg for std::list? The documentation I just checked says you can only use an allocator class there, default std::allocator<LINE>

What does the code you're porting mean by LINE& as a second template arg to std::list?

What does VC++ accept as a second template arg to std::list?
 
Old 02-10-2009, 11:17 AM   #3
linux_chris
LQ Newbie
 
Registered: Dec 2008
Posts: 18

Original Poster
Rep: Reputation: 0
Hi John, Thanks. You are right, the second arg doesn;t have any meaning. So, I removed the second arg (class CLineList : public std::list<LINE>) and now I am able to compile successfully.

Thank You
-Chris
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Porting COM application to Linux gnraghu Programming 1 10-05-2006 10:55 PM
HP-UX to linux porting arunprakash Other *NIX 2 03-01-2005 10:53 PM
Porting C++ from HP-UX 11.0 to Linux paul sachs Other *NIX 2 01-10-2005 05:37 PM
Porting from Solaris to Linux raees Linux - General 3 11-10-2003 09:26 AM
Porting to Linux?? 00-00-00 Linux - General 1 05-27-2002 09:20 PM


All times are GMT -5. The time now is 01:10 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration