Closed GoogleCodeExporter closed 8 years ago
Hello again,
I found an error in my CMakeLists.txt with the patch suggested in issue 70
(replace -D_QEXTSERIALPORT_STATICLIB by -DQEXTSERIALPORT_STATICLIB) and was
able to compile the static Qextserialport (precision with respect to the first
post: i'm using win32 with VisualStudio2008).
However, i still have a linker error when trying to build a simple example:
#include <QApplication>
#include <qextserialenumerator.h>
#include <qextserialport.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
return app.exec();
}
I get the following unresolved external symbol:
"__declspec(dllimport) public: static class QList<struct QextPortInfo> __cdecl
QextSerialEnumerator::getPorts(void)"
Same thing when I try to open a port, with a project where i just try to create
a new port (QextSerialPort * port1 = new QextSerialPort("COM1",
QextSerialPort::EventDriven);):
unresolved external symbol "public: virtual struct QMetaObject const *
__thiscall QextSerialPort::metaObject(void)const "
In my CMakeList.txt i have included the follwing windows libraries when
building the lib since it was suggested in some posts:
setupapi
advapi32
user32
shell32
Original comment by sandrine...@gmail.com
on 11 Aug 2010 at 1:11
I can confirm the same issue here, when building "enumerator" example and using
QextSerialPort as a static lib.
>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport)
public: static class QList<struct QextPortInfo> __cdecl
QextSerialEnumerator::getPorts(void)"
(__imp_?getPorts@QextSerialEnumerator@@SA?AV?$QList@UQextPortInfo@@@@XZ)
referenced in function _main
While symbol seems to be defined in the lib ... (I've included
qextserialenumerator_win.cpp into the lib)
MSVC 2010 win64
Original comment by dstep...@gmail.com
on 16 Nov 2011 at 10:02
The problem is solved for me by modofying the following line in
"qextserialenumerator.h"
ln 96> class QEXTSERIALPORT_EXPORT QextSerialEnumerator : public QObject
TO> class QextSerialEnumerator : public QObject
So, perhaps, the macro QEXTSERIALPORT_EXPORT need to be changed ...
Original comment by dstep...@gmail.com
on 16 Nov 2011 at 10:16
Original comment by dbzhang...@gmail.com
on 16 Mar 2012 at 8:49
Original issue reported on code.google.com by
sandrine...@gmail.com
on 11 Aug 2010 at 10:08Attachments: