   Template for STL Templates compile errors
  Hi all,Like the subject says, i'm trying to make a wrapper for some STL containers. But STL causes some weirds error at compile time. Since i'm not a template guru, i thought i was going to ask here...#include <list>using namespace std;namespace System{  template <typename type>class List  {  private:    list<type> innerList;  public:    List();    ~List();  }}This code generate, at compile time, thoses errors:error C2079: 'std::_List_nod<_Ty,_Alloc>::_Node::_Myval' uses undefined class 'type'   with   [  _Ty=type,  _Alloc=std::allocator<type>   ]   \include\list(108) : see reference to class template instantiation 'std::_List_nod<_Ty,_Alloc>::_Node' being compiled   with   [  _Ty=type,  _Alloc=std::allocator<type>   ]While this code works... I've simply add another template class LList to acts as the STL list template.#include <list>using namespace std;namespace System{  template <typename type>class LList  {  public:    LList() { };    ~LList() { };  };  template <typename type>class List  {  private:    LList<type> innerList;  public:    List();    ~List();  }}Anyone can explains me what is wrong with thoses STL containers?!NOTE: Before anyone ask why i do that, i want to abstract the usage of List(s) from theirs implementation. So, in the future, i'll only need to change my List template if i want to switch to Boost or others.Thanks,Jonathan   
  Missing ";" at the end of your class declaration? It is the only error I get when I compile your code. BTW, you will never be able to provide a good enough encapsulation of a list class. The std::list class is using iterators that can be used with the Standard C++ Library algorithms (in the <algorithm> header). If you want to provide the same functionality, you'll have to export the iterators - or to encapsulate the algorithm. In the end, you're going to encapsulate everything in the standard library, which is uterly useless because, you know, it is the standard library :) (and you'll not be able to provide the same flexibility as it already provide, meansing that some day you'll be limited by your encapsulation). Regards,   ;  Hummm, thanks for the reply, i was so desabused from that error. In my head, i though everything was fine and should be able to compile.After your post i did a little test program (i should have done this before) and your right, its working. But the ending ; is just a typo error in the post.I'm doing a framework that looks like .NET for C++ (i hate c and stl syntax style) ;)I'll give more informations since its not working for my framework:  - I'm using Visual Studio 2003  - I'm building a dll projectThe List.h file:#pragma once#ifndef __LIST_H#define __LIST_H#include <list>using namespace std;#include "Common.h"namespace System{  namespace Collections  {    template <typename type> class FRAMEWORK_API List    {    private: list<type> innerList;    public: List(); ~List();    // here, there's alot of properties and methods definitions    };  }}#endif //#ifndef __LIST_HThe Common.h file:#pragma once#ifndef __COMMON_H#define __COMMON_H#ifdef CPPFRAMEWORK_EXPORTS#define FRAMEWORK_API __declspec(dllexport)#else#define FRAMEWORK_API __declspec(dllimport)#endif#endif //#ifndef __COMMON_HI think the errors come from the fact i'm using namespaces. But i'm not sure...Thanks,Jonathan   ;Quote:Original post by LowRad  - I'm building a dll projectDLL + Templates = Problems.   ;  Thanks Fruny for your reply,i've search google without success   ;Quote:Original post by LowRadI'm doing a framework that looks like .NET for C++ (i hate c and stl syntax style) ;)That's a good idea. Managed C++ is really crap, and the .NET framework is only working with C# because MS guys are too lazy to support C++</sarcasm> [grin];  Hummm, while reading the microsoft paper about this problem, they seems to say the problem reside in generating the exports for thoses types when building a .dll.So i've change from a .dll to an .lib and now everything seems to work fine again.Anyone has comments on this. I mean, is there any others problems or pitfalls to expect?Thanks,Jonathan   ;  You can't really use static libraries wth templates either, unless you explicitly instantiate every instantiation you'll ever need in your source.Libraries which provide template classes/functions must be header libraries.   