Восстановление расположения Contry с помощью GPS в Qt - PullRequest
0 голосов
/ 05 августа 2011

Я новичок в Qt, и мне дали это задание ...

Обнаружить страну с помощью GPS - и отобразить ее в текстовом поле.

Ну, так как я новичок в этом, я понятия не имею, что делать, когда это происходит. я начал с поиска в интернете

Я оказался здесь: http://www.developer.nokia.com/Community/Wiki/File:Qt_for_Maemo_Location_Example.zip

поэтому я скачал код и запустил его, появилось множество ошибок

..\liblocation\locationinfowidget.cpp:1:34: error: hildon/hildon-banner.h: No such file or directory
In file included from ..\liblocation\locationinfowidget.cpp:5:
..\liblocation\/locationinfowidget.h:18: error: 'LocationGPSDeviceFix' has not been declared
..\liblocation\/locationinfowidget.h:20: error: 'LocationGPSDeviceStatus' has not been declared
..\liblocation\/locationinfowidget.h:23: error: 'LocationGPSDevice' has not been declared
..\liblocation\/locationinfowidget.h:23: error: 'gpointer' has not been declared
..\liblocation\/locationinfowidget.h:24: error: 'LocationGPSDevice' has not been declared
..\liblocation\/locationinfowidget.h:24: error: 'gpointer' has not been declared
..\liblocation\/locationinfowidget.h:25: error: 'LocationGPSDevice' has not been declared
..\liblocation\/locationinfowidget.h:25: error: 'gpointer' has not been declared
..\liblocation\/locationinfowidget.h:33: error: ISO C++ forbids declaration of 'LocationGPSDevice' with no type
..\liblocation\/locationinfowidget.h:33: error: expected ';' before '*' token
..\liblocation\/locationinfowidget.h:34: error: ISO C++ forbids declaration of 'LocationGPSDControl' with no type
..\liblocation\/locationinfowidget.h:34: error: expected ';' before '*' token
..\liblocation\locationinfowidget.cpp: In constructor 'LocationInfoWidget::LocationInfoWidget(QWidget*)':
..\liblocation\locationinfowidget.cpp:33: error: 'control' was not declared in this scope
..\liblocation\locationinfowidget.cpp:33: error: 'location_gpsd_control_get_default' was not declared in this scope
..\liblocation\locationinfowidget.cpp:35: error: 'location_gpsd_control_start' was not declared in this scope
..\liblocation\locationinfowidget.cpp:37: error: 'device' was not declared in this scope
..\liblocation\locationinfowidget.cpp:37: error: 'LocationGPSDevice' was not declared in this scope
..\liblocation\locationinfowidget.cpp:37: error: expected primary-expression before ')' token
..\liblocation\locationinfowidget.cpp:37: error: expected ';' before 'g_object_new'
..\liblocation\locationinfowidget.cpp:40: error: 'G_CALLBACK' was not declared in this scope
..\liblocation\locationinfowidget.cpp:40: error: 'g_signal_connect' was not declared in this scope
..\liblocation\locationinfowidget.cpp: In destructor 'virtual LocationInfoWidget::~LocationInfoWidget()':
..\liblocation\locationinfowidget.cpp:50: error: 'device' was not declared in this scope
..\liblocation\locationinfowidget.cpp:51: error: 'g_object_unref' was not declared in this scope
..\liblocation\locationinfowidget.cpp:53: error: 'control' was not declared in this scope
..\liblocation\locationinfowidget.cpp:54: error: 'location_gpsd_control_stop' was not declared in this scope
..\liblocation\locationinfowidget.cpp: At global scope:
..\liblocation\locationinfowidget.cpp:57: error: variable or field 'updateStatus' declared void
..\liblocation\locationinfowidget.cpp:57: error: 'LocationGPSDeviceStatus' was not declared in this scope
mingw32-make[1]: *** [debug/locationinfowidget.o] Error 1
mingw32-make: *** [debug] Error 2

Так я все делаю неправильно? Есть ли более простой способ сделать такие вещи? Пожалуйста, будьте конкретны, я был бы признателен

1 Ответ

0 голосов
/ 05 августа 2011

Ну, первая ошибка действительно говорит само за себя: "hildon/hildon-banner.h: Нет такого файла или каталога".

Вы пропустили хотя бы этот файл. Вероятно, этот файл объявлен LocationGPSDeviceFix, что объясняет вторую ошибку «LocationGPSDeviceFix не был объявлен». И оттуда вниз по склону. В C ++ вы должны действительно начать исправлять ошибки сверху вниз.

Кстати, GPS просто говорит вам долготу и широту. Вам нужна карта , чтобы перевести это в страну. Идентификатор телефонной сети может быть проще; первые три цифры - мобильный код страны (MCC)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...