解决使用#include setupapi.h报出错误的问题

在使用windows驱动与应用程序进行交互时,可能会用到常用的SetupApi,SetupApi被包含在#include <setupapi.h>头文件中,如果大家直接使用这个头文件的话,会报错很多错误。

因为setupapi.h依赖这些头文件:

1 #include <windows.h>    // Includes basic windows functionality.
2 #include <stdio.h>      // Includes the standard i/o functions.
3 #include <string.h>     // Includes the string functions.
4 #include <tchar.h>      // Includes the string functions.
5 #include <setupapi.h>   // Includes the SetupAPI.

另外还要调用setupapi.lib

1 // Link with SetupAPI.Lib.
2 #pragma comment (lib, "setupapi.lib")

然后就可以正常使用Setup API了。

猜你喜欢

转载自www.cnblogs.com/acmexyz/p/11647937.html
今日推荐