Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I am facing issues with a project called ServiceConfigurationManager, using Visual Studio 2010. To be more specific, when I try to execute the following line of code in a file called ServiceConfugrationManagerModule.h:

C++
class CServiceConfigurationManagerModule
    : public CAtlServiceModuleT <cserviceconfigurationmanagermodule,>, public CWindowImpl<cserviceconfigurationmanagermodule>
{</cserviceconfigurationmanagermodule>


I'm met with a barrage of errors, the most important of which is:

txt
c:\work\main\actra5.x\projects\serviceconfigurationmanager\serviceconfigurationmanagermodule.h(32): error C2504: 'CAtlServiceModuleT' : base class undefined
c:\work\main\actra5.x\projects\serviceconfigurationmanager\serviceconfigurationmanagermodule.h(32): error C2143: syntax error : missing ',' before '<'



CAtlServiceModuleT is defined in atlbase.h. I am not entirely sure of the problem, but I suspect that somehow a macro called _ATL_NO_SERVICE is incorrectly defined due to some settings. In atlbase.h, CAtlServiceModuleT is defined following the statement '#ifndef _ATL_NO_SERVICE'. (Note that atlbase.h is included in my stdafx.h, which in turn is included in ServiceConfigurationModule.h)

The project compiles without a hitch in Visual Studio 2005, it also compiles perfectly if I change the Platform Toolset to v90 in the Property Pages.

Does anyone have any suggestions on how to fix this problem? Unfortunately, I cannot provide the entire code since it was written internally by my company.
Posted
Updated 12-Aug-10 11:23am
v2
Comments
GPUToaster™ 12-Aug-10 5:30am    
Try finding out the 2010 header file. See its declaration and how to use it. May be the declarations have changed in 2010. :)

Did you know that you need to resetup your include directories, etc?
Visual Studio 2010 is nice enough to remove all of your global directories for all of your projects and you have to reset them up manually. I suggest that you use environment variables... I did it the hard way the first time and then found out that you can use LIB and INCLUDE environment variables.
 
Share this answer
 
There is a context menu item "Go To Definition" in a source view of a Studio.
Use it in your opened solution for _ATL_NO_SERVICE :)
 
Share this answer
 
Original VS2008/VS2005 Source in stdafx.h compiles just fine but will not compile on VS2010 with same error.
error C2504: 'CAtlServiceModuleT' : base class undefined


XML
#include <afx.h>
#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
    #include <afxdtctl.h>       // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
    #include <afxcmn.h>         // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#undef _AFX
#undef _ATL_NO_SERVICE

#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>


Updated VS2010 Source in stdafx.h compiles just fine. Trick is to swap AFX and ATL order and add #undef _WINDOWS_ before including the MFC headers did the trick for me.
XML
#undef _ATL_NO_SERVICE
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#undef _WINDOWS_

#include <afx.h>
#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
    #include <afxdtctl.h>       // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
    #include <afxcmn.h>         // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#undef _AFX
 
Share this answer
 
v2
Comments
SoMad 24-Jun-12 0:39am    
The question is 2 years old, he has probably been able to get it working since then.

Soren Madsen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900