1、cmakeLists.txt 文件引入相应的库:
cmake_minimum_required(VERSION 3.5) project(test1 LANGUAGES CXX) file(GLOB SRC ./*.cpp ./*.h) add_executable(test1 ${SRC}) include(GNUInstallDirs) target_link_libraries(${PROJECT_NAME} hid setupapi ) install(TARGETS test1 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
2、代码 以C的方式编译
#include "Standardcation.h" extern "C" { #include <setupapi.h> #include <hidsdi.h> #include <initguid.h> } #include <hidclass.h> #include <Dbt.h> #include <new> #include <tchar.h> #include <strsafe.h> #include <iostream> #include "CRC.h" #include "RC4.h"
标签:test1,HIDD,reference,hid,报错,include,USB From: https://www.cnblogs.com/RedWetPlace/p/18180433