PDA

View Full Version : QSerialPortInfo error



GeneCode
13th September 2017, 05:30
I am working on simple app on windows to scan the serial port. Error:

undefined reference to `_imp___ZN15QSerialPortInfo14availablePortsEv'
My Code:

foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
// do something

}
What does the error mean and how to fix it.

Ginsengelf
13th September 2017, 07:06
Hi, did you add
QT += serialport
to your .pro file?

Ginsengelf

d_stranz
13th September 2017, 17:45
Or if you are using Visual Studio and MSVC++, did you add Qt5SerialPort.lib to your project properties (Project -> Properties -> Configuration Properties -> Linker -> Additional Dependencies)

Remember that in Windows, the Debug and Release configurations use different link libraries (Qt5SerialPortD.lib vs. Qt5SerialPort.lib, respectively), as well as different libraries for 32- vs. 64-bit builds.