2014-01-22 2 views
4

응용 프로그램에서 사용하는 iris xmpp 라이브러리라는 라이브러리에 신호가 있습니다. Mac OS X 및 Linux에서는 모든 것이 잘 작동하지만 Windows에서는 경고를 찾을 수없는 모든 신호를 생성합니다.외부 DLL에 Qt 신호가 없습니다.

warning: QObject::connect: signal not found in XMPP::AdvancedConnector 
warning: QObject::connect: signal not found in XMPP::AdvancedConnector 
warning: QObject::connect: signal not found in XMPP::AdvancedConnector 
warning: QObject::connect: signal not found in XMPP::AdvancedConnector 
warning: QObject::connect: signal not found in XMPP::QCATLSHandler 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::ClientStream 
warning: QObject::connect: signal not found in XMPP::Client 
warning: QObject::connect: signal not found in XMPP::Client 
warning: QObject::connect: signal not found in XMPP::Client 
warning: QObject::connect: signal not found in XMPP::Client 

내가 사용하려고 하나 개의 신호의 예는 다음

conn = std::make_shared<XMPP::AdvancedConnector>(); 
QObject::connect(conn.get(), &XMPP::AdvancedConnector::srvLookup, this, &XmppConnection::connServerLookupHandler); 
QObject::connect(conn.get(), &XMPP::AdvancedConnector::srvResult, this, &XmppConnection::connServerResultHandler); 
QObject::connect(conn.get(), &XMPP::AdvancedConnector::httpSyncStarted, this, &XmppConnection::connHttpSyncStartedHandler); 
QObject::connect(conn.get(), &XMPP::AdvancedConnector::httpSyncFinished, this, &XmppConnection::connHttpSyncFinishedHandler); 

if(QCA::isSupported("tls")) { 
    tls = make_unique<QCA::TLS>(); 
    tlsHandler = make_unique<XMPP::QCATLSHandler>(tls.get()); 
    // dont check the certificate because we self sign 
    tlsHandler->setXMPPCertCheck(false); 
    QObject::connect(tlsHandler.get(), &XMPP::QCATLSHandler::tlsHandshaken, this, &XmppConnection::tlsHandshakenHandler); 
} else { 
    tls = 0; 
    tlsHandler = 0; 
} 

stream = std::make_shared<XMPP::ClientStream>(conn.get(), tlsHandler.get()); 
QObject::connect(stream.get(), &XMPP::ClientStream::connected, this, &XmppConnection::streamConnectedHandler); 
QObject::connect(stream.get(), &XMPP::ClientStream::securityLayerActivated, this, &XmppConnection::streamSecurityLayerActivatedHanlder); 
QObject::connect(stream.get(), &XMPP::ClientStream::needAuthParams, this, &XmppConnection::streamNeedAuthParamsHandler); 
QObject::connect(stream.get(), &XMPP::ClientStream::authenticated, this, &XmppConnection::streamAuthenticatedHandler); 
QObject::connect(stream.get(), &XMPP::ClientStream::connectionClosed, this, &XmppConnection::streamConnectionClosedHandler); 
QObject::connect(stream.get(), &XMPP::ClientStream::delayedCloseFinished, this, &XmppConnection::streamDelayedCloseFinished); 
QObject::connect(stream.get(), &XMPP::ClientStream::readyRead, this, &XmppConnection::streamReadyRead); 
QObject::connect(stream.get(), &XMPP::ClientStream::stanzaWritten, this, &XmppConnection::streamStanzaWritten); 
QObject::connect(stream.get(), &XMPP::ClientStream::warning, this, &XmppConnection::streamWarningHandler); 
QObject::connect(stream.get(), &XMPP::ClientStream::error, this, &XmppConnection::streamErrorHandler); 

xmpp = std::make_shared<XMPP::Client>(); 
QObject::connect(xmpp.get(), &XMPP::Client::rosterRequestFinished, this, &XmppConnection::onRosterRequestFinished); 
QObject::connect(xmpp.get(), &XMPP::Client::rosterItemAdded, this, &XmppConnection::onRosterItemAdded); 
QObject::connect(xmpp.get(), &XMPP::Client::rosterItemUpdated, this, &XmppConnection::onRosterItemUpdated); 
QObject::connect(xmpp.get(), &XMPP::Client::rosterItemRemoved, this, &XmppConnection::onRosterItemRemoved); 

내 실제 슬롯 중 하나입니다

signals: 
    void srvLookup(const QString &server); 

내 연결 전화

입니다

void XmppConnection::connServerLookupHandler(const QString &server) 
{ 
    qDebug() << "Looking up Server: " << server; 
    return; 
} 

내가 왜 맥과 내가 알아낼 수 없다. inux 작업 및 windows 않습니다. 나는 컴파일러 옵션에 대해 생각해 왔지만, cmake를 사용한다. 왜냐하면 내 리눅스 gcc와 내 mingw gcc 사이에 커다란 차이가 없다면, 왜 그렇게 중요한지는 알 수 없다. 내 연결 호출에 의해 분명히 C++ 11 기능을 사용하고 있습니다. 그러나 적절하게 컴파일하고 링크하므로 C++ 11 기능이 예상대로 작동한다고 가정합니다. 누구나 아이디어가 있으십니까?

편집 :

것은 내가 Qt5.2.0는 MinGW는 OpenGL을 사용하고 있습니다. MinGW48과 같은 MinGW 32를 사용하고 있습니다. 저는 응용 프로그램과 동시에 iris 라이브러리를 컴파일하고 automake에 cmake를 사용하여 링크 종속성으로 설정하고 권한을 포함시킵니다. 헤더.

EDIT2 : 모든 내 연결 호출이 포함됩니다.

+0

Windows에서 사용한 Qt와 GCC가 일치합니까? XMMP 라이브러리가 사용했던 GCC와 일치합니까? – rubenvb

+0

내가 작성하는 방법에 대한 정보로 편집 됨. – Buttink

+0

함수 포인터를 가져 오는 데 C++ 11이 필요하지 않습니다. 경고에는 connect 문에 나열되지 않은 클래스가 나와 있으므로 실패하는 다른 연결이 있어야합니다. XMPP 자체에서 온 것일까 요? –

답변

5

내 창의력이 엉덩이에 나를 물린 것으로 밝혀졌습니다. 따라서 Windows에서 기호를 내보내는 경우이 이상한 문장 "__declspec (dllexport)"을 포함시켜야합니다.

그래서 내가 무슨 짓을했는지 내가 그럼 난 모든

class IRIS_EXPORT ClassNameHere { ... } 
IRIS_EXPORT void StaticFunctionNameHere(){...} 

에이를 사용합니다 그리고 이것은 내 문제를 해결

/** 
* @brief Allows for windows exported symbols 
* 
* Windows requries a special modifier to allow them to export correctly. 
* This macro allows that while leaving Mac OS X and Linux alone. 
* 
* While Qt can tell us if it was make for WIN32, MAC, or LINUX, It cannot 
* tell us if we are being statically or dynamically linked. That is why 
* this is using the CMake variables instead of Qt 
*/ 
#if defined (_WIN32) 
    // cmake makes this variable if your a shared library (projectname_EXPORTS) 
    #if defined(iris_EXPORTS) 
    #define IRIS_EXPORT Q_DECL_EXPORT 
    #else 
    #define IRIS_EXPORT Q_DECL_IMPORT 
    #endif /* iris_EXPORTS */ 
#else /* defined (_WIN32) */ 
#define IRIS_EXPORT 
#endif 

을 추가합니다.

here, here 또는 here으로 이동하십시오.

관련 문제