Lots of undefined reference to `_imp__ZN on windows qextserialport
I am linking to qextserialport statically. It works in Linux, but when I compile the project in Windows I get a bunch of linker errors that all look like:
error: undefined reference to
_imp___ZN14QextSerialPort11setBaudRateE12BaudRateType' error: undefined reference to_imp___ZN14QextSerialPort5flushEv'
error: undefined reference to `_imp___ZN14QextSerialPort11setBaudRateE12BaudRateType'
... and so on. There are about 90 of them.
All of the errors are complaining about things that are defined in qextserialport.h and used in qestserialport.cpp (I have not checked all of the errors, but about 10 of them are this way). It is curious that this is happening in the linker, as qextserialport seems to be compiling properly.
All of my object files are being dumped into the source folder, so there should be no path issues. I am pretty sure that the linker is finding qextserialport.o
It's also strange that it's working on Linux (same project) but not Windows.
Can anybody point me in the right direction?
Welcome to devnet
Your problem might be missing macro definitions for windows.
I assume that any necessary macros are defined in the qextserialport header file. Are there other windows-specific files that I might be missing? Those
_imp__ZN...strings don't look like standard windows macros.
Is your project actually linking against QextSerialPort?
First, thanks for the responses. It's nice to see that these forums are active!
qextserialport is being compiled along with the rest of my source. The qextserialport object file being in the linker's path should take care of this. This works on Linux.
I tried specifying -lqextserialport in the build options, the linker complains about there being no such system library (as expected). Users will not have this library, and I do not want to install the library with my application. It needs to be statically linked.
Is it possible that I'm not linking to some Windows library that qexserialport relies on?
Maybe you are using an old version, if you still have such issues with latest qextserialport
feel free to report bugs.
Judging from the symbol names I would say that you are trying to link dynamically against a static version of the library. Make sure QEXTSERIALPORT_BUILD_SHARED is not defined.