I am trying to follow the steps of a Simple COM Tutorial which looks nice and logical to me. I would normally shy away from using a wizard but consensus seems to be this is the best way to do COM.
To summarize
- Create an ATL project with the wizard
- Use the Add Class dialog to create an ATL simple object (
SimpleChatServerin the example) - Navigate into ClassView, right click the interface for the object, Add Method (
CallMein the example) - The tutorial gives a method body to use
- Compile
My compilation, however, fails because
error C2509: 'CallMe' : member function not declared in 'CSimpleChatServer'
Has something gone wrong with the wizard? I would have expected VS to automatically declare the CallMe method in CSimpleChatServer, and provide a method stub for me to add the implementation, which it didn’t.
(Another difference from the tutorial is that the class browser doesn’t show the class CSimpleChatServer, which you would think it would. Might this be because I have disabled intellisense? Hopefully a separate issue).
So, what to do, where and how do I define and declare the actual C++ method with the functionality?
So – it was to do with intellisense. I had disabled intellisense by renaming
feacp.dlldue to the need to compile boost::geometry as recommended in the boost docs. This caused the COM add class dialog to silently fail to add stub methods to my.hand.cppfile.Giving
C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages\feacp.dllits original name back seems to fix this.