Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Strange error message

Strange error message

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hint_54
    wrote on last edited by
    #1

    I all I have the following scheme on two classes:

    template <typename T> class MyClass {

    public:

    class MySubClass {

     public:
    
        ~MySubClass( void );
    

    };

    };

    And I tryed:

    template <typename T> MyClass<T>::MySubClass::~MySubClass( void )
    {
    }

    And also:

    template <typename T> class MyClass {

    public:

     template <typename T> class MySubClass {
    
        public:
    
           ~MySubClass( void );
     };
    

    };

    With:

    template <typename T> MyClass<T>::MySubClass<T>::~MySubClass( void )
    {
    }

    But I get the message "error C2039: '__dtor' : is not a member of 'tBaseArray<T>'" for the 1st case and that same message plus "error C2935: '<Unknown>' : template-class-id redefined as a global function" for the 2nd case. I tryed googling for __dtor, and it seems to be a function to enable using delete on a class, but I don't understand why I get this error neither how to bypass it. Can anybody help?? =) best regards hint_54

    S 1 Reply Last reply
    0
    • H hint_54

      I all I have the following scheme on two classes:

      template <typename T> class MyClass {

      public:

      class MySubClass {

       public:
      
          ~MySubClass( void );
      

      };

      };

      And I tryed:

      template <typename T> MyClass<T>::MySubClass::~MySubClass( void )
      {
      }

      And also:

      template <typename T> class MyClass {

      public:

       template <typename T> class MySubClass {
      
          public:
      
             ~MySubClass( void );
       };
      

      };

      With:

      template <typename T> MyClass<T>::MySubClass<T>::~MySubClass( void )
      {
      }

      But I get the message "error C2039: '__dtor' : is not a member of 'tBaseArray<T>'" for the 1st case and that same message plus "error C2935: '<Unknown>' : template-class-id redefined as a global function" for the 2nd case. I tryed googling for __dtor, and it seems to be a function to enable using delete on a class, but I don't understand why I get this error neither how to bypass it. Can anybody help?? =) best regards hint_54

      S Offline
      S Offline
      Sarath C
      wrote on last edited by
      #2

      Its working fine with my VC++ 7 compiler

      template class MyClass {

      public:

      class MySubClass {
      
      public:
      
      	~MySubClass( void );
      };
      

      };

      template MyClass::MySubClass::~MySubClass( void )
      {
      }

      i created the instance as follows

      MyClass t;

      SaRath.
      "It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar." My Blog | Understanding State Pattern in C++

      H 1 Reply Last reply
      0
      • S Sarath C

        Its working fine with my VC++ 7 compiler

        template class MyClass {

        public:

        class MySubClass {
        
        public:
        
        	~MySubClass( void );
        };
        

        };

        template MyClass::MySubClass::~MySubClass( void )
        {
        }

        i created the instance as follows

        MyClass t;

        SaRath.
        "It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar." My Blog | Understanding State Pattern in C++

        H Offline
        H Offline
        hint_54
        wrote on last edited by
        #3

        That's exactly what I wanted.. But it's not working with VC++ 6 =$ thx ;) hint_54

        M 1 Reply Last reply
        0
        • H hint_54

          That's exactly what I wanted.. But it's not working with VC++ 6 =$ thx ;) hint_54

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          VC6's template support was not complete, especially when dealing with complex classes like your example. Sometimes, you just have to say it ain't gonna work in 6. BTW, "dtor" is the abbreviation for "destructor" (along with "ctor" for "constructor")

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups