grrrr.... MSVC++

From: Mike Redick (Telos@MAD.SCIENTIST.COM)
Date: 01/04/01


Ok... this code compiles and runs fine on whatever compiler my Solaris
account has at school. But when I try it on Microsoft's compiler at home I
get a bunch of linking errors. I could just do all the work at school but
they have wierd rules about who owns the code developed on their systems so
wanna do it at home... not sure if I'm running into some portability issue
or if it's just that microsoft sucks. ;) Any hints would probably be
helpful...

#include<list>
template<class _T> class NameList : public std::list<_T>
{
public:
 NameList();
 virtual ~NameList();
 bool Insert( _T anObject );
 _T Get( std::string name );
 void Remove( _T anObject );
};

#include"NameList.h"

template< class _T >
NameList<_T>::NameList()
{
}

template< class _T >
NameList<_T>::~NameList()
{
}

template< class _T >
bool NameList<_T>::Insert( _T anObject )
{
 push_front( anObject );
 return true;
}

template< class _T >
_T NameList<_T>::Get( std::string name )
{
 iterator i;
 _T target;
 for( i = begin(); i != end(); i++ )
 {
  target = *i;
  if( name == target.Names() )
   return target;
 }
 return NULL;
}

template< class _T >
void NameList<_T>::Remove( _T anObject )
{
}

This compiles and runs fine back on Solaris... but on Microsoft I get these
link errors:

Linking...
test.obj : error LNK2001: unresolved external symbol "public: virtual
__thiscall NameList::~NameList(void)" (??1?$NameList@PAVObject@@@@UAE@XZ)
test.obj : error LNK2001: unresolved external symbol "public: class Object
* __thiscall NameList::Get(class std::basic_string,class std::allocator >)"
(?Get@?$NameList@PAVObject@@@@QAEPAVObjec
t@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
test.obj : error LNK2001: unresolved external symbol "public: bool
__thiscall NameList::Insert(class Object *)" (?Insert@?
$NameList@PAVObject@@@@QAE_NPAVObject@@@Z)
test.obj : error LNK2001: unresolved external symbol "public: __thiscall
NameList::NameList(void)" (??0?$NameList@PAVObject@@@@QAE@XZ)
Debug/mudlib.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.


So if anyone knows what's wrong lemme know... and thanks. :)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/03/01 PST