求助*^_^*(在线等待ing)

mimimumu 2003-08-22 02:07:46
下面的代码可以通过编译,但是链接时总出错:

//===============================================
GUID interfaceguid;
memcpy( &interfaceguid,
&(GUID_CLASS_USB_DEVICE),
sizeof(struct _GUID));
HDEVINFO hUsbDevInfo=SetupDiGetClassDevs(
&interfaceguid,NULL,NULL,
DIGCF_DEVICEINTERFACE|DIGCF_PRESENT);
//===============================================

出错信息:

--------------------Configuration: DdkSec - Win32 Debug--------------------
Linking...
DdkSecDlg.obj : error LNK2001: unresolved external symbol _GUID_CLASS_USB_DEVICE
Debug/DdkSec.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

DdkSec.exe - 2 error(s), 0 warning(s)

-----------------------------------------

难道是我的环境搭建还有错误?还是……?

恳请高手们指点,在线等待
...全文
33 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
mimimumu 2003-08-28
  • 打赏
  • 举报
回复
hoho~~~谢谢大家哦!

:)
VCP4 2003-08-26
  • 打赏
  • 举报
回复
看来已OK了:)
farfh 2003-08-26
  • 打赏
  • 举报
回复
我怀疑他在机子前睡着了
whoo 2003-08-26
  • 打赏
  • 举报
回复
嗬嗬,这一在线在得好长...
AthlonxpX86 2003-08-26
  • 打赏
  • 举报
回复
应该可以结贴了吧
akiko 2003-08-23
  • 打赏
  • 举报
回复
看看缺少什么lib,project--setting--link里填上
zhoujianhei 2003-08-23
  • 打赏
  • 举报
回复
你缺少一个包含GUID_CLASS_USB_DEVICE 的 .Lib文件,在属性里加入即可。
approach 2003-08-23
  • 打赏
  • 举报
回复
/* A5DCBF10-6530-11D2-901F-00C04FB951ED */
DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, \
0xC0, 0x4F, 0xB9, 0x51, 0xED);

// Attention : You'd better install the DDK for winXp.
mimimumu 2003-08-22
  • 打赏
  • 举报
回复
可是,如果没包含GUID_CLASS_USB_DEVICE的话,

编译时就会出错吧?说是“没定义的变量”。

并且,我在usbioctl.h中也找到了它的定义。

我的包含文件:

#include <windows.h>

#include <setupapi.h>

#pragma comment(lib, "setupapi")

#include <stdio.h>

#include <winreg.h>

#include <regstr.h>

#include <objbase.h>

#include <tchar.h>

#include <usbioctl.h>

我的Lib:

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib cfgmgr32.lib

kingzai 2003-08-22
  • 打赏
  • 举报
回复
You can define your guids in a header file, but you should init your guids
in exactly one CPP file.
search GUID_CLASS_USB_DEVICE in your project.
zhouyong0371 2003-08-22
  • 打赏
  • 举报
回复
问题出现在GUID_CLASS_USB_DEVICE,她的实现部分没有在程序里边。具体原因,你再找一下。是不是包含他的文件不再工程里边?

2,640

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧