自定义ComboxBox串口扫描析构时出错
首先是源码:
网上源码基本都一样可以参考:
https://blog.youkuaiyun.com/Mark_md/article/details/109048127
其次是问题:
在debug模式下启动可正常运行,
在release模式下扫描串口析构时出错。
以下为调用堆栈:
ntdll.dll!_RtlReportCriticalFailure@12() 未知
ntdll.dll!_RtlpReportHeapFailure@4() 未知
ntdll.dll!_RtlpHpHeapHandleError@12() 未知
ntdll.dll!_RtlpLogHeapFailure@24() 未知
ntdll.dll!_RtlpFreeHeapInternal@20() 未知
ntdll.dll!RtlFreeHeap() 未知
ucrtbase.dll!_free_base() 未知
ucrtbase.dll!_free() 未知
> HallMotorTest.exe!operator delete(void * block, unsigned int __formal) 行 31 C++
HallMotorTest.exe!QList<QSerialPortInfo>::~QList<QSerialPortInfo>() 行 874 C++
HallMotorTest.exe!myComboBox::scanActivePort() 行 35 C++
HallMotorTest.exe!myComboBox::myComboBox(QWidget * parent) 行 10 C++
原因:
在VS + QT环境下添加 附加依赖项 时 全部配置成了 Qt5SerialPortd.lib;%(AdditionalDependencies)
Qt5SerialPortd.lib 是debug环境下使用的动态链接库
Qt5SerialPort.lib 是release环境下使用的动态链接库
改正:
附加依赖项 改为添加对应动态链接库
1万+

被折叠的 条评论
为什么被折叠?



