在Mac上构建Qt消息传递框架

时间:2012-06-19 14:47:07

标签: macos qt qt-mobility

我正在尝试从OS X 10.6上的Git源代码构建最新版本的QMF,但我一直遇到这个错误:

"QPrivatelyImplemented<QMailMessageBodyPrivate>::~QPrivatelyImplemented()", referenced from:
  QMailMessageBody::~QMailMessageBody()in qmfstoragemanager.o
  QMailMessageBody::~QMailMessageBody()in qmfstoragemanager.o
  PartStorer::operator()(QMailMessagePart const&)in qmfstoragemanager.o
  PartLoader::operator()(QMailMessagePart&)in qmfstoragemanager.o
 "QPrivatelyImplemented<QMailMessageHeaderFieldPrivate>::~QPrivatelyImplemented()", referenced from:
  QMailMessageContentType::~QMailMessageContentType()in qmfstoragemanager.o
  QMailMessageContentType::~QMailMessageContentType()in qmfstoragemanager.o
  ReferenceLoader::operator()(QMailMessagePart&)in qmfstoragemanager.o
  PartLoader::operator()(QMailMessagePart&)in qmfstoragemanager.o
"QPrivatelyImplemented<QMailMessagePartContainerPrivate>::~QPrivatelyImplemented()", referenced from:
  QMailMessage::~QMailMessage()in qmfstoragemanager.o
"QPrivatelyImplemented<QMailMessageMetaDataPrivate>::~QPrivatelyImplemented()", referenced from:
  QMailMessage::~QMailMessage()in qmfstoragemanager.o
 "QPrivatelyImplemented<QMailMessageMetaDataPrivate>::operator=(QPrivatelyImplemented<QMailMessageMetaDataPrivate> const&)", referenced from:
  QmfStorageManager::load(QString const&, QMailMessage*) in qmfstoragemanager.o
"QPrivatelyImplemented<QMailMessagePartContainerPrivate>::operator=(QPrivatelyImplemented<QMailMessagePartContainerPrivate> const&)", referenced from:
  QmfStorageManager::load(QString const&, QMailMessage*) in qmfstoragemanager.o
ld: symbol(s) not found for architecture x86_64
然而,它确实在Ubuntu下完美编译并且我足够接近我在OS X之前编译它所以我有点困惑,通常没有找到明显的符号意味着缺少一些源代码,任何人来在我开始拆开它之前,我是什么?

1 个答案:

答案 0 :(得分:1)

发生此错误是因为编译器忽略了远离库的未引用类。 我能够通过在 src \ libraries \ qmfclient \ qmailinstantiations.cpp 中的所有显式模板实例化(或者只是将其添加到文件末尾)之后添加以下代码来解决此问题:

class reference_holder
{
    struct helper
    {
        helper(QPrivatelyImplemented<QMailMessageBodyPrivate>* = 0)
        {
        }

        ~helper()
        {
        }
    };

    static helper helper_;

    static void use_helper()
    {
        (void)helper_;
    }

    template<void(*)()>
    struct helper2 {};

    static helper2<&reference_holder::use_helper> helper2_;
};