MsXml6 无法正确链接 [英] MsXml6 failing to link properly

查看:29
本文介绍了MsXml6 无法正确链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试使用 msxml,但出现链接器 (VS 2012) 错误,无法弄清楚原因.

Hello I am trying to use msxml and I am getting a linker (VS 2012) error and can't figure out why.

我的类文件具有以下标头声明:

My class file has the following header declaration:

#include <MsXml6.h>

class Foo
{
   ....
   private:
   static IXMLDOMDocument* document;
};

然后我使用以下内容引用文档(导致链接错误):

I then reference the document with the following (which gives the link error):

CoCreateInstance(CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)&document);

我已将项目设置为链接到 msxml6.lib.日志如下:

I have the project setup to link against msxml6.lib. The logs are as follows:

Searching C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x64\msxml6.lib:
1>        Found IID_IXMLDOMDocument
1>          Referenced in Foo.obj
1>          Loaded msxml6.lib(msxml6_i.obj)

...

1>Foo.obj : error LNK2001: unresolved external symbol "private: static struct IXMLDOMDocument * Foo::document" (?document@Foo@@0PEAUIXMLDOMDocument@@EA)
1>Some.exe : fatal error LNK1120: 1 unresolved externals

有什么重要的东西我遗漏了吗?如果您需要更多信息,请告诉我.

Is there something important I am missing? Let me know if you need more info.

谢谢!

推荐答案

我发现问题了,我忘记在源文件中声明文档变量了.

I found the problem, I forgot to declare the document variable in the source file.

这篇关于MsXml6 无法正确链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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