Retreving Contry Location Using GPS in Qt
I am new to Qt , and i have been given this task ...
to Detect the country using GPS - and to display it in a textbox .
Well since am new to this i have no clue what so ever how to do such thing. i started by searching over the internet
i ended up here: http://www.developer.nokia.com/Community/Wiki/File:Qt_for_Maemo_Location_Example.zip
so i downloaded the code and run it , tons of errors appeared
..\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
So am I doing it all wrong ? Is there a simpler way to do such things? Please be Specific, I would appreciate it
Well, the first error really says it all: "hildon/hildon-banner.h
: No such file or directory".
You're missing at least that file. Probably that file declared LocationGPSDeviceFix
, which explains the second error "'LocationGPSDeviceFix' has not been declared". And from there on it's downhill. In C++, you should really start fixing errors from the top down.
BTW, GPS just tells you longitude and latittude. You need a map to translate that into a country. Phone network ID may be easier; the first three digits are the Mobile Country Code (MCC)
精彩评论