Error: 'qtmobility' no es un nombre de nombres
-
14-11-2019 - |
Pregunta
Estoy tratando de compilar: http://wiki.forum.nokia.com/index.php / fetching_a_map_tille_in_qt_using_google_maps
Estoy usando QT-Mobility 1.2 con QT 4.7 en OpenSUSE 11.2
Los errores que estoy recibiendo son:
MainWindow.h:7: error: ‘QtMobility’ is not a namespace-name
MainWindow.h:7: error: expected namespace-name before ‘;’ token
MainWindow.h:10: error: expected class-name before ‘{’ token
In file included from /opt/qtsdk-2010.05/qt/include/QtCore/qcoreapplication.h:47,
from /opt/qtsdk-2010.05/qt/include/QtGui/qapplication.h:45,
from /opt/qtsdk-2010.05/qt/include/QtGui/QApplication:1,
from main.cpp:2:
/opt/qtsdk-2010.05/qt/include/QtCore/qeventloop.h:51: error: expected initializer before ‘QtCoreModule’
make: *** [main.o] Error 1
Mi archivo .pro contiene:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
HEADERS += MainWindow.h
SOURCES += main.cpp MainWindow.cpp
QT += network
CONFIG += mobility
MOBILITY = location
El error se informa en el archivo de encabezado, que he demostrado de la siguiente manera:
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QPaintEvent>
#include <QPixmap>
using namespace QtMobility;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow ();
void paintEvent(QPaintEvent* paintEvent);
public slots:
void handleNetworkData(QNetworkReply* reply);
private:
void fetchMap(const QSize& size, qreal latitude, qreal longitude);
private:
QNetworkAccessManager networkAccessManager;
QPixmap mapPixmap;
}
por favor guía.
Solución
You'll need to include at least one QtMobility
header to be able to use that namespace.
Also that using namespace
declaration is not the recommended way anymore. Use:
QTM_USE_NAMESPACE
instead (see QtMobility QuickStart).
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow