How to Solve QT and PCIe interactive loading setupapi.H error

Setupapi.H relies on these header files

#include <Windows.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <strsafe.h>
#include <stdint.h>
#include <SetupAPI.h>
#include <INITGUID.H>
#include <WinIoCtl.h>
//#include <AtlBase.h>
#include <io.h>
#include "xdma_public.h"
#include "pcie_fun.h"

1. The error is reported as follows:


the loading sequence of the adjustment header file is as follows:

#include <SetupAPI.h>
#include <strsafe.h>

About to #include & lt; strsafe.h> Put #include & lt; SetupAPI.h> Just behind.

2. Then continue to report an error

because it is not linked to the setupapi.lib library
Library location: C:\program files (x86)\Microsoft SDKs\windows\v7.1a\lib\setupapi.lib

Solution: load the library into the project.

1. Create a new lib folder under the project path, copy the library to the Lib folder, and add it in the project * * *. Pro

LIBS +=  -L$$PWD/lib/  -lSetupAPI

2. A simpler way is to add directly

LIBS += -lSetupAPI

Read More: