x64 上的 WMI 链接器错误 [英] WMI Linker Error on x64

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

问题描述

我正在尝试使用 msdn 中的 WMI 示例:

I'm trying to use the WMI example from msdn:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384724%28v=vs.85%29.aspx

我已将最后一组代码逐字复制到 VS2008 中的控制台应用程序中.如果我在 win32 平台上发布或调试应用程序,它编译(并运行)正常.如果我在 x64 平台上发布或调试它,我会收到以下链接器错误:

I've copied the last set of code there verbatim into a console application in VS2008. If I have the application in release or debug for the win32 platform, it compiles (and runs) fine. If I have it in release or debug for the x64 platform, I get the following linker errors:

CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemConfigureRefresher
CppConsole.obj : error LNK2001: unresolved external symbol CLSID_WbemRefresher
CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemRefresher
CppConsole.obj : error LNK2001: unresolved external symbol CLSID_WbemLocator
CppConsole.obj : error LNK2001: unresolved external symbol IID_IWbemLocator
fatal error LNK1120: 5 unresolved externals

我已经尝试将 wbemuuid.lib 直接放入项目属性中的链接器输入中,但这与编译指示没有区别.

I've already tried putting the wbemuuid.lib into the linker input directly in the project properties, but that didn't make a difference from the pragma.

有人在 x64 上做过这个工作吗?还是我做错了什么?

Has anybody made this work with x64? Or is there something else I'm doing wrong?

推荐答案

我为此感谢 RRUZ,因为他/她至少让我走上了正轨,但因为他们还没有发布答案(只是一个评论)我不能点击它们以获得信用.

I give credit to RRUZ for this, as he/she at least put me on the right track, but as they haven't posted an answer-answer (just a comment) I can't click them for credit.

基本上,由于我所处的工作环境,项目目录以非标准"方式设置.在另一个版本不正确(不是 x64)的目录中已经有 wbemuuid.lib 的副本,并且该目录在库包含列表中更高,因此永远无法进入正确的 Windows 平台库目录.

Basically, because of the work environment I'm in, the project directories are set up in a "non-standard" way. There was already a copy of wbemuuid.lib in another directory that was not the correct version (not x64), and that directory was higher on the library include list, thus never getting to the right Windows Platform library directory.

因此,如果您在使用 x86 与 x64 以及库包含时遇到问题,请检查您的目录并检查它们的顺序.

So if you ever have problems with x86 vs x64 and library includes, check your directories and check the ORDER of them as well.

这篇关于x64 上的 WMI 链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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