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

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

问题描述

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

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

http://msdn.microsoft.com/zh-cn/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.

基本上,因为在我所处的工作环境中,项目目录是以非标准方式设置的。在另一个目录中,已经存在wbemuuid.lib的副本,该副本不是正确的版本(不是x64),并且该目录在库包含列表中位于较高位置,因此永远不会到达正确的Windows Platform库目录。

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天全站免登陆