转串口包给出错误:“未定义引用”

时间:2019-06-06 16:01:25

标签: go serial-port cgo

我正在努力使此软件包在Windows中对我有用: https://github.com/mikepb/go-serial 当我调用其功能之一时,它给了我类似以下错误:

C:\Users\WIN10\AppData\Local\Temp\go-build787754682\b002\_x007.o: In function `get_port_details':
libs\serial/windows.c:345: undefined reference to `__imp_SetupDiGetClassDevsA'
libs\serial/windows.c:358: undefined reference to `__imp_SetupDiOpenDevRegKey'
libs\serial/windows.c:350: undefined reference to `__imp_SetupDiEnumDeviceInfo'
libs\serial/windows.c:376: undefined reference to `__imp_CM_Get_Parent'
libs\serial/windows.c:379: undefined reference to `__imp_CM_Get_DevNode_Registry_PropertyA'
libs\serial/windows.c:396: undefined reference to `__imp_SetupDiDestroyDeviceInfoList'
libs\serial/windows.c:404: undefined reference to `__imp_CM_Get_Device_IDA'
libs\serial/windows.c:383: undefined reference to `__imp_SetupDiDestroyDeviceInfoList'

我没有足够的库处理经验,因此我认为我应该在编译之前执行一些步骤,但是自述文件没有任何说明,因此请帮助我使其运行。

0 个答案:

没有答案