Header for CBaseObject ?

Hi everybody,

I’m also trying to write a plugin using VS2010.

I try to use the formatting service that is described in chapter 12 and have a trivial problem writing the method CreateInstance of the class MyFormatImplementation. The line

IFormatServiceCallbackPtr p = new CBaseObject< MyFormatImplementation >();

gives the error: error C2061: syntax error : identifier 'CBaseObject’

I guess it is because I’m not including the right header file, but I can’t seem to find the right one :frowning:

any idea what I’m doing wrong ?


1 Like


IFormatServiceCallback* p = new CBaseObject< MyFormatImplementation >();

1 Like


I tried your suggestion, but that made no difference.

During compilation I still get the mentioned error, which indicates that a type specifier is expected…

Currently I’m including

#include “stdafx.h”
#include <sstream>                // wostringstream
#include “RSPlugin.h”
#include “MyFormatImplementation.h”

Is there anything obvious missing?


1 Like


#include “RSPlugin.h”, which you state you are using, should be sufficient.

It might just be a namespace issue.  Try putting this at the top of your source file, somewhere after your include statements:

using namespace RS;

CBaseObject is defined under that namespace, so the compiler won’t recognize it unless the namespace is included.  You can also skip the ‘using’ declaration and just prepend RS:: to CBaseObject anytime you refer to it, for instance, RS::CBaseObject.  But with the ‘using’ statement, you avoid having to know which items are under RS and which are not, leaving you free to just refer to the type name unqualified.

You might also want to put this:

using namespace RSServices;

in your source files, to avoid needing to worry about qualifying any of those types, too.

1 Like