无法得到简单的COM项目工作:在哪里和如何放置实现? [英] Can't get simple COM project to work: where and how to put implementation?

查看:203
本文介绍了无法得到简单的COM项目工作:在哪里和如何放置实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想按照简单COM教程,看起来不错,



总结


  1. 使用向导创建ATL项目

  2. 使用添加类对话框创建一个ATL简单对象( SimpleChatServer 在示例中)

  3. 导航到ClassView,右键单击对象的接口,添加方法( CallMe

  4. 本教程提供了一个方法体使用

  5. 编译

我的编译失败,因为

 错误C2509:'CallMe'在'CSimpleChatServer'

向导出了问题?我希望VS在CSimpleChatServer中自动声明CallMe方法,并提供一个方法存根给我添加实现,但它没有。



从教程是类浏览器不显示类CSimpleChatServer,你会认为它可能是因为我已禁用intellisense?希望一个单独的问题)。



那么,该怎么做,在哪里和如何定义和声明具有该功能的实际C ++方法。

解决方案

所以 - 这是与intellisense。我已禁用intellisense重命名 feacp.dll 由于需要编译boost :: geometry ,如boost文件中所建议。这导致COM添加类对话框静默无法添加stub方法到我的 .h .cpp 文件。 / p>

给予 C:\Program Files\ Microsoft Visual Studio 9.0 \VC\vcpackages\feacp.dll 它的原来的名字回来似乎解决这个问题。


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

  1. Create an ATL project with the wizard
  2. Use the Add Class dialog to create an ATL simple object (SimpleChatServer in the example)
  3. Navigate into ClassView, right click the interface for the object, Add Method (CallMe in the example)
  4. The tutorial gives a method body to use
  5. 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.dll due 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 .h and .cpp file.

Giving C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages\feacp.dll its original name back seems to fix this.

这篇关于无法得到简单的COM项目工作:在哪里和如何放置实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆