Qt中

2011-08-05 44 views
0

我是新來的Qt,和我一直在考慮這個任務Retreving Contry位置使用GPS ...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 

所以我在做這一切錯了嗎?有沒有更簡單的方法來做這樣的事情?請具體,我將不勝感激

+0

您需要安裝SDK - 您沒有正確安裝SDK。 –

+0

更具體請馬上使用Qt Creator .... –

回答

0

那麼,第一個錯誤真的說明了一切:「hildon/hildon-banner.h:沒有這樣的文件或目錄」。

您至少缺少該文件。可能該文件聲明爲LocationGPSDeviceFix,這說明第二個錯誤「'LocationGPSDeviceFix'尚未聲明」。從那裏開始下坡。在C++中,你應該開始從上到下修復錯誤。

順便說一句,GPS只是告訴你的經度和latittude。你需要一個地圖將其翻譯成一個國家。電話網絡ID可能更容易;前三位數字是移動國家代碼(MCC)

+0

可以詳細解釋手機網絡ID嗎?像那究竟是什麼?我怎麼才能得到那個文件丟失? –

+0

任何GSM或更好的電話網絡都有一個移動網絡代碼;我的目前是20404.因此,我的國家代碼是204,即荷蘭。 maemo(諾基亞)設備可能連接到移動電話網絡。 – MSalters

+0

我如何訪問它? –