[CMake] Win32: DLL fails to find Qt symbols but .so builds in Linux
Stephen Collyer
scollyer at netspinner.co.uk
Fri Nov 23 07:21:51 EST 2007
I'm building some simple shared libraries and an executable
that links against them under both Win32 and Linux. All of
the libraries and exe build and link correctly under Linux,
but when building the DLLs under Win32 I get link errors.
e.g. I have a class that looks like this:
#include <QMutex>
#include <QQueue>
#include <QString>
#include <QWaitCondition>
...
class COMMS_EXP Comms
{
public:
...
private:
QQueue<QString> messageq;
QMutex qmutex;
QWaitCondition message_available;
};
with a cmake command like this:
ADD_LIBRARY(Comms Comms.cpp)
When I build the appropriate project in VS, I get LNK2019 messages
relating to QMutex, QWaitCondition, and so on (I've attached a small
section of these).
I'm not at all clear what's going on here, and I don't even
understand why VS has a "link" stage when building a DLL.
Can anyone explain ? The only possibility I can think of is
that the linker is looking for the export lists from the
Qt libraries (i.e. the .lib files) but is failing to find them.
--
Regards
Steve Collyer
Netspinner Ltd
-------------- next part --------------
------ Build started: Project: Comms, Configuration: Debug Win32 ------
Compiling...
Comms.cpp
Compiling manifest to resources...
Linking...
Creating library Debug\Comms.lib and object Debug\Comms.exp
Comms.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QMutex::~QMutex(void)" (__imp_??1QMutex@@QAE at XZ) referenced in function __unwindfunclet$??0Comms@@QAE at XZ$0
Comms.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QWaitCondition::QWaitCondition(void)" (__imp_??0QWaitCondition@@QAE at XZ) referenced in function "public: __thiscall Comms::Comms(void)" (??0Comms@@QAE at XZ)
C
More information about the CMake
mailing list