C++ 对`RPositionServer::RPositionServer()的未定义引用`
我正在使用诺基亚Qt SDK为诺基亚5230(S60第五版平台)编写程序。我在检索地理位置信息时遇到问题。我试着用诺基亚论坛的例子(http://bit.ly/be3QDK 第一个)。以下代码:C++ 对`RPositionServer::RPositionServer()的未定义引用`,c++,qt,geolocation,symbian,nokia,C++,Qt,Geolocation,Symbian,Nokia,我正在使用诺基亚Qt SDK为诺基亚5230(S60第五版平台)编写程序。我在检索地理位置信息时遇到问题。我试着用诺基亚论坛的例子(http://bit.ly/be3QDK 第一个)。以下代码: #include <lbs.h> #include <lbsrequestor.h> #include <lbscommon.h> #include <lbsposition.h> #include <lbspositioninfo.h> #i
#include <lbs.h>
#include <lbsrequestor.h>
#include <lbscommon.h>
#include <lbsposition.h>
#include <lbspositioninfo.h>
#include <lbssatellite.h>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
RPositionServer server;
RPositioner positioner;
User::LeaveIfError(server.Connect());
CleanupClosePushL(server);
// use default positioning module
User::LeaveIfError(positioner.Open(server));
CleanupClosePushL(positioner);
// Set the Requestor information
_LIT(KCntPhone, "+358501234567");
_LIT(KSrvName, "MyService");
RRequestorStack stack;
CRequestor* contact = CRequestor::NewLC(CRequestor::ERequestorContact,CRequestor::EFormatTelephone,KCntPhone);
stack.Append(contact);
CRequestor* service = CRequestor::NewLC(CRequestor::ERequestorService,CRequestor::EFormatApplication,KSrvName);
stack.Append(service);
User::LeaveIfError(positioner.SetRequestor(stack));
//Issue a Location Request
TRequestStatus status;
TPositionInfo posInfo;
positioner.NotifyPositionUpdate(posInfo, status); // asynchronous request
User::WaitForRequest(status); // for exemplification only, AOs should be used
User::LeaveIfError(status.Int());
//Use the location information present in the posInfo object
//Cleanup
stack.Reset();
CleanupStack::PopAndDestroy(service);
CleanupStack::PopAndDestroy(contact);
CleanupStack::PopAndDestroy(&positioner); // this will call Close() method
CleanupStack::PopAndDestroy(&server); // this will call Close() method
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
if (source) {
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),this, SLOT(positionUpdated(QGeoPositionInfo)));
source->startUpdates();
}
}
等等。我做的不对吗?我必须链接到哪个库?thnx.您必须链接到Lbs.lib。请参阅参考。您必须链接到Lbs.lib。请参阅参考。我在.pro文件
win32:LIBS+=C:\NokiaQtSDK\Symbian\SDK\epoc32\release\armv5\lib\lbs.lib中添加了以下行
,但它并没有解决我的问题。我做错了什么?您将其添加为win32库,而缺少Symbian库。你需要做symbian:LIBS+=llbs(有两个l,第一个表示“library”),我在我的.pro文件win32:LIBS+=C:\NokiaQtSDK\symbian\SDK\epoc32\release\armv5\lib\lbs.lib
中添加了以下行,但它没有解决我的问题。我做错了什么?您将其添加为win32库,而缺少Symbian库。您需要执行symbian:LIBS+=llbs(有两个l,第一个表示“library”)
Undefined reference to `RPositionServer::RPositionServer()`