Can't Compile QXmpp
-
Hello,
When i try to compile the very basic thing that include file of qxmpp i get alot of errors
my program is"
#include <QtCore/QCoreApplication>
#include "QXmppClient.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);return a.exec();
}
"and this is all the error
"In file included from ..\xmpp01\main.cpp:2:
..\xmpp01/QXmppClient.h:28:27: error: QAbstractSocket: No such file or directory
..\xmpp01/QXmppClient.h:30:32: error: QXmppConfiguration.h: No such file or directory
..\xmpp01/QXmppClient.h:31:25: error: QXmppLogger.h: No such file or directory
..\xmpp01/QXmppClient.h:32:27: error: QXmppPresence.h: No such file or directory
In file included from ..\xmpp01\main.cpp:2:
..\xmpp01/QXmppClient.h:81: error: expected class-name before '{' token
..\xmpp01/QXmppClient.h:139: error: ISO C++ forbids declaration of 'QXmppConfiguration' with no type
..\xmpp01/QXmppClient.h:139: error: expected ',' or '...' before '&' token
..\xmpp01/QXmppClient.h:147: error: ISO C++ forbids declaration of 'QXmppConfiguration' with no type
..\xmpp01/QXmppClient.h:147: error: expected ';' before '&' token
..\xmpp01/QXmppClient.h:148: error: ISO C++ forbids declaration of 'QXmppLogger' with no type
..\xmpp01/QXmppClient.h:148: error: expected ';' before '*' token
..\xmpp01/QXmppClient.h:149: error: 'QXmppLogger' has not been declared
..\xmpp01/QXmppClient.h:151: error: 'QAbstractSocket' has not been declared
..\xmpp01/QXmppClient.h:151: error: ISO C++ forbids declaration of 'SocketError' with no type
..\xmpp01/QXmppClient.h:151: error: expected ';' before 'socketError'
..\xmpp01/QXmppClient.h:153: error: 'QXmppStanza' has not been declared
..\xmpp01/QXmppClient.h:153: error: ISO C++ forbids declaration of 'Condition' with no type
..\xmpp01/QXmppClient.h:153: error: expected ';' before 'xmppStreamError'
..\xmpp01/QXmppClient.h:197: error: 'QXmppLogger' has not been declared
..\xmpp01/QXmppClient.h:235: error: ISO C++ forbids declaration of 'QDomElement' with no type
..\xmpp01/QXmppClient.h:235: error: expected ',' or '...' before '&' token
..\xmpp01/QXmppClient.h:236: error: 'QAbstractSocket' has not been declared
..\xmpp01/QXmppClient.h:236: error: expected ',' or '...' before 'state'
"please help me to understand out what i am doing wrong.
-
I think that you doesn't have a headers in INCLUDEPATH:
"How to set up INCLUDEPATH":http://developer.qt.nokia.com/doc/qt-4.7/qmake-variable-reference.html#id-cb5803da-df55-4b1f-9916-c9dd845da133
Check also a set up of Qt:
"How to set up Qt":http://developer.qt.nokia.com/doc/qt-4.7/gettingstarted-develop.html#id-e159ef20-f4cf-4c1a-a34a-1650a2df1b54 -
Add to your .pro file:
@
QT += network
@and probbly too:
@
QT += xml
@ -
[quote author="Volker" date="1324823845"]Add to your .pro file:
@
QT += network
@and probbly too:
@
QT += xml
@
[/quote]thanks that helped,
i added to the project file the flowing things@
INCLUDEPATH += "d:\DataY\Dev\XMPP\xmpp01\qxmpp-0.3.91\src"
QT += network
QT += xml
@[EDIT: code formatting for .pro snippet, Volker]
and now i get other error, i am not understand what i am doing wrong it's not my first time that i use qt.
this is the errors i get
"debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop_-MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:118: undefined reference toQXmppLoggable::qt_metacast(char const*)' debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:123: undefined reference to
QXmppLoggable::qt_metacall(QMetaObject::Call, int, void**)'
debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop-MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:137: undefined reference toQXmppClient::connectToServer(QString const&, QString const&)' debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:138: undefined reference to
QXmppClient::disconnectFromServer()'
debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop-MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:139: undefined reference toQXmppClient::sendPacket(QXmppPacket const&)' debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:141: undefined reference to
QXmppClient::sendMessage(QString const&, QString const&)'
debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:142: undefined reference toQXmppClient::_q_elementReceived(QDomElement const&, bool&)' debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:143: undefined reference to
QXmppClient::q_socketStateChanged(QAbstractSocket::SocketState)'
debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:144: undefined reference toQXmppClient::_q_streamConnected()' debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:145: undefined reference to
QXmppClient::q_streamDisconnected()'
debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop-MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:154: undefined reference toQXmppClient::logger() const' debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:155: undefined reference to
QXmppClient::state() const'
debug/moc_QXmppClient.o:D:\DataY\Dev\XMPP\xmpp01-build-desktop-Qt_4_7_4_for_Desktop-_MinGW_4_4__Qt_SDK__Debug/debug/moc_QXmppClient.cpp:161: undefined reference toQXmppClient::setLogger(QXmppLogger*)' debug/moc_QXmppClient.o:moc_QXmppClient.cpp:(.rdata+0x0): undefined reference to
QXmppLoggable::staticMetaObject'
debug/moc_QXmppClient.o:moc_QXmppClient.cpp:(.rdata$_ZTV11QXmppClient[vtable for QXmppClient]+0x14): undefined reference toQXmppClient::~QXmppClient()' debug/moc_QXmppClient.o:moc_QXmppClient.cpp:(.rdata$_ZTV11QXmppClient[vtable for QXmppClient]+0x18): undefined reference to
QXmppClient::~QXmppClient()'
debug/moc_QXmppClient.o:moc_QXmppClient.cpp:(.rdata$_ZTV11QXmppClient[vtable for QXmppClient]+0x28): undefined reference to `QXmppLoggable::childEvent(QChildEvent*)'
"as u can see the problem come from the library qxmpp
thanks for the help -
You must link to the xmpp lib too, eg. like this:
@
LIBS += "d:\DataY\Dev\XMPP\xmpp01\qxmpp-0.3.91\lib"
LIBS += -lxmpp
@You must adjust the path and the lib name. Search for something like qxmpp.lib (probably or libqxmpp.lib) and put that directory into the first line. Then add -lwhateveryoufound without the .lib in the second line.
Unless you have built a static library, you will need the DLL in a search path for your application to run.
-
We want to use qxmpp lib in Qt5.1 for Android, but the class “QsslSocket” is not implemented in Qt5.1 for Android, can we use qxmpp without “QsslSocket”? (use “QtcpSocket” instead of “QsslSocket”?).
And do you have any advice? Thanks.