Qt Mobility in QtSDK
Hello everyone,
I am trying to play with the APIs of QtMobility, but i am having compiling errors. I am including the following headers:
- #include <qmessageservice>
- #include <qmessage>
- #include <qmessageaddress>
- #include <qmessageManager>
Then, i am adding the macro QTM_USE_NAMESPACE, then in the main code i am doing something like this:
- int main(int argc, char *argv[])
- {
- QMessageService* serviceAction = new QMessageServiceAction();
But i am having the following errors:
C:\Users\JTorres\Documents\QtProjects\QML\QtMobilityExamples\main.cpp:14: error: expected type-specifier before ‘QMessageServiceAction’
C:\Users\JTorres\Documents\QtProjects\QML\QtMobilityExamples\main.cpp:14: error: cannot convert ‘int*’ to ‘QtMobility::QMessageService*’ in initialization
C:\Users\JTorres\Documents\QtProjects\QML\QtMobilityExamples\main.cpp:14: error: expected ‘,’ or ‘;’ before ‘QMessageServiceAction’
In the .pro file i am adding “mobility”:
- CONFIG += mobility
- MOBILITY += messaging
Anyone knows what i am doing wrong?, it is like the compiler is not finding the right headers.
Thanks in advance!
10 replies
How about the code in Line 14 ?
This is the complete code in main that i wrote just for testing:
- #include <QtGui/QApplication>
- #include <qmessageservice>
- #include <qmessage>
- #include <qmessageaddress>
- #include <qmessageManager>
- #include "qmlapplicationviewer.h"
- QTM_USE_NAMESPACE
- int main(int argc, char *argv[])
- {
- QMessageService* serviceAction = new QMessageServiceAction();
- QmlApplicationViewer viewer;
- viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer.showExpanded();
- return app.exec();
- delete serviceAction;
- }
I’m sorry, but what’s the QMessageServiceAction ? It seems that’s the problem.
You`re absolutely right!!!!, i was changing the code “QMessageServiceAction” to “QMessageService”, but i couldn’t see that i forgot to change one of them, so sorry, my misstake…
I can’t find the Class introduction in Qt document. So, where you find the code ?
I have found it in a book called “Qt for Symbian”, maybe in Qt Mobility 1.0 that class exists….
By the way, is it normal that the headers appear “underlined” like if it doesn’t exist:

I think them should be
#include <qmessageservice.h> #include <qmessage.h> #include <qmessageaddress.h> #include <qmessageManager.h> @</blockquote> either that or
#include <QMessageService>
#include <QMessage>
#include <QMessageAddress>
#include <QMessageManager>
@
Also as long as the compiler doesn’t give you a header not found warning, it may be ok that it’s underlined in Qt Creator (the include path is set through qmake and I don’t know if Qt Creator parses that properly-there are two different parser implementation and qmake’s is larger).
Chunk.Gao is the same behaviour:

either that orAlso as long as the compiler doesn’t give you a header not found warning, it may be ok that it’s underlined in Qt Creator (the include path is set through qmake and I don’t know if Qt Creator parses that properly-there are two different parser implementation and qmake’s is larger).
#include <QMessageService> #include <QMessage> #include <QMessageAddress> #include <QMessageManager>
It still underline in Qt Creator:

The compiler doesn’t give me any warning about those headers, i mean it compiles fine…but the Qt Classes that are inside that headers, won’t be highlighted in the code editor and i can’t use the autocompletion method because the Qt Creator parser doesn’t find those headers…
You must log in to post a reply. Not a member yet? Register here!


