[英]error LNK2001: unresolved external symbol _CLSID_XYS
There is one idl file defined in microsoft sdk which is not available in VS2005. 在microsoft sdk中定义了一个idl文件,这在VS2005中不可用。 I am using some of the interfaces from that IDL.
我正在使用该IDL的一些接口。
Now this works fine on VS 2010 . 现在这在VS 2010上运行良好。 I want to make it compile on VS2005.
我想让它在VS2005上编译。
I copied the header file to my project directory. 我将头文件复制到我的项目目录中。 But it is giving me compilation error.
但它给了我编译错误。
When I looked into header file , the class id is defined in it as EXTERN_C const CLSID CLSID_Xyz. 当我查看头文件时,类id在其中定义为EXTERN_C const CLSID CLSID_Xyz。
Now it is defined as extern so it means it should be declared somewhere else in code. 现在它被定义为extern,因此它意味着它应该在代码中的其他地方声明。
So my question is just including .h file is sufficient or do I need to also include _i.c file. 所以我的问题是只包括.h文件就足够了或者我还需要包含_i.c文件。
Any suggestions 有什么建议么
Once you examine that _i.c file you'll see the indeed the CLSID constants are defined there. 一旦你检查了_i.c文件,你就会看到确实在那里定义了CLSID常量。 So yes, you need to incorporate that .c file into you program - either by #including it into a .c or .cpp file or just by adding it to your project so that it compiles separately and then links into the final binary.
所以,是的,您需要将.c文件合并到您的程序中 - 通过#include它到.c或.cpp文件中,或者只是将它添加到您的项目中,以便它单独编译然后链接到最终的二进制文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.