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. Deriving a template class? Please help.

Deriving a template class? Please help.

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++visual-studiodebugging
2 Posts 1 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.
  • C Offline
    C Offline
    clintsinger
    wrote on last edited by
    #1

    Hi, I am running into a problem with deriving an atl class. I am using VS.Net and have run the wizard to create an non-attributed atl service. I want it to be an interactive service so I decided that I would need to derive the CAtlServiceModuleT class and add m_status.dwServiceType |= SERVICE_INTERACTIVE_PROCESS; to make the service an interactive process. This is the class that I created in a header file I call ATLINTERACTIVEPROCESS.H

    #pragma once
    
    #include <atlbase.h>
    
    #ifndef _ATL_NO_SERVICE
    template <class T, UINT nServiceNameID>
    class ATL_NO_VTABLE CAtlInteractiveServiceModuleT : public CAtlServiceModuleT<T, nServiceNameID>
    {
    public :
    
    	CAtlInteractiveServiceModuleT() throw()
    	{
    		m_status.dwServiceType |= SERVICE_INTERACTIVE_PROCESS;
    	}
    };
    #endif
    

    When I compile this I get the following errors ATLINTERACTIVESERVICE.h(7) : error C2504: 'CAtlServiceModuleT' : base class undefined ATLINTERACTIVESERVICE.h(15) : see reference to class template instantiation 'CAtlInteractiveServiceModuleT' being compiled ATLINTERACTIVESERVICE.h(7) : error C2143: syntax error : missing ',' before '<' I would assume that including <atlbase.h> would "define" the base class. If I take the code and drop it in the atlbase.h header file just under CAtlServiceModuleT<> everything compiles fine. Unfortunately I don't want to keep this code in the atlbase.h file because it could be changed by microsoft and my collegues would have to have a "special" version of atlbase.h to compile this service. Does anyone have any idea what I am doing wrong? Can derived template classes exist in other header files than their base classes? Are there defines that I am missing? As a side note is there a way to debug the compile pass? Please help!!:) Cheers, Clint

    C 1 Reply Last reply
    0
    • C clintsinger

      Hi, I am running into a problem with deriving an atl class. I am using VS.Net and have run the wizard to create an non-attributed atl service. I want it to be an interactive service so I decided that I would need to derive the CAtlServiceModuleT class and add m_status.dwServiceType |= SERVICE_INTERACTIVE_PROCESS; to make the service an interactive process. This is the class that I created in a header file I call ATLINTERACTIVEPROCESS.H

      #pragma once
      
      #include <atlbase.h>
      
      #ifndef _ATL_NO_SERVICE
      template <class T, UINT nServiceNameID>
      class ATL_NO_VTABLE CAtlInteractiveServiceModuleT : public CAtlServiceModuleT<T, nServiceNameID>
      {
      public :
      
      	CAtlInteractiveServiceModuleT() throw()
      	{
      		m_status.dwServiceType |= SERVICE_INTERACTIVE_PROCESS;
      	}
      };
      #endif
      

      When I compile this I get the following errors ATLINTERACTIVESERVICE.h(7) : error C2504: 'CAtlServiceModuleT' : base class undefined ATLINTERACTIVESERVICE.h(15) : see reference to class template instantiation 'CAtlInteractiveServiceModuleT' being compiled ATLINTERACTIVESERVICE.h(7) : error C2143: syntax error : missing ',' before '<' I would assume that including <atlbase.h> would "define" the base class. If I take the code and drop it in the atlbase.h header file just under CAtlServiceModuleT<> everything compiles fine. Unfortunately I don't want to keep this code in the atlbase.h file because it could be changed by microsoft and my collegues would have to have a "special" version of atlbase.h to compile this service. Does anyone have any idea what I am doing wrong? Can derived template classes exist in other header files than their base classes? Are there defines that I am missing? As a side note is there a way to debug the compile pass? Please help!!:) Cheers, Clint

      C Offline
      C Offline
      clintsinger
      wrote on last edited by
      #2

      The 'CAtlServiceModuleT' class is hidden by the ATL namespace. Cheers, Clint

      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