English 中文(简体)
在2010年视觉工作室编辑 IDL 文件时无法生成必要文件
原标题:can not generate necessary file when compile IDL file in visual studio 2010

i 通过互联网辅导(http://www.codeguru.com/cpp/com-tech/activex/tutorics/article.php/c5567/Step-by-Step-COM-Tutor.htm)了解COM。

  1. Open VS2010
  2. Create Win32 DLL project name AddObj
  3. 添加内容的 IAdd.idl 文件

    导入“ kunknwn.idl” ;

    [ object, uuid(1221db62-f3d8-11d4-825d-00104b3646c0), helpstring("interface IAdd is used for implementing a super-fast addition Algorithm") ]

    interface IAdd : IUnknown { HRESULT SetFirstNumber(long nX1);

    HRESULT SetSecondNumber(long nX2); HRESULT DoTheAddition([out,retval] long *pBuffer); };

    [ uuid(3ff1aab8-f3d8-11d4-825d-00104b3646c0), helpstring("Interfaces for Code Guru algorithm implementations .") ] library CodeGuruMathLib { importlib("stdole32.tlb"); importlib("stdole2.tlb");

    interface IAdd; }

在此之后, 跟随教程, 如果我编辑 IAdd. idl 文件, 它将生成 :

-IAdd.h 包含 C++ 样式接口声明。

-dlldata.c 包含代理 DLL 的代码。 当在不同的进程/ 计算机上引用对象时非常有用 。

-IAdd.tlb Binary 文件, 带有定义明确的格式, 完整描述我们的接口 IAdd 及其所有方法。 此文件将分发给我们 COM 组件的所有客户 。

-IAdd_p.c 包含代理 DLL 的拼接代码。 在不同的进程/计算机上引用对象时非常有用 。

--IAdd_i.c 包含界面 IID

但当我用右键单击 IAdd 编译时, 并选择以快捷键菜单进行编译时, 没有文件正在生成。 但是当打开视图类时, 我可以看到使用某种方法的 IAdd 接口 。

我也尝试手工编译它, 从互联网下载 midl.exe, 并在命令行运行, 但失败了 。

我用Google罚款了很多材料,所有材料都说我可以用视觉工作室编集IDl文件,但我尝试了很多时间,在我的两部电脑上,但是在我编译IDl文件后没有生成任何文件。我还安装了新的Win7,新的视觉工作室2010最终,但没有任何变化。

最佳回答

I just created a new project and created a new idl file with the code you specified.If i right click and choose compile it works just fine (VS2010 Ultimate).
Did you choose the correct filetype in the fileproperties of VS? It should be "IDL File".

Have you used the VS Command Prompt as you tried to compile it manually?
(The VS Command Prompt will set all necessary environment variables)

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签