对“RPositionServer::RPositionServer()”的未定义引用

发布于 2024-09-25 05:24:19 字数 2203 浏览 4 评论 0原文

我正在使用诺基亚 Qt SDK 为诺基亚 5230(S60 第五版平台)编写程序。我在检索地理位置信息时遇到问题。我正在尝试使用诺基亚论坛的示例(http://bit.ly/be3QDK 第一个)。以下代码:

#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();
    }
}

当我尝试制作它时,出现链接器错误:

Undefined reference to `RPositionServer::RPositionServer()`

等等。我做错了什么?我必须链接哪个库?谢谢。

i'm writing program for Nokia 5230 (S60 5th edition platform) using Nokia Qt SDK. I have the problem with retrieving geolocation info. I'm trying to use example from nokia forum (http://bit.ly/be3QDK first one). The following code:

#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();
    }
}

when I try to make it i got linker error:

Undefined reference to `RPositionServer::RPositionServer()`

and so on. What I did incorrect? What library I have to link against? thnx.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ㄖ落Θ余辉 2024-10-02 05:24:19

您必须链接到 Lbs.lib。请参阅参考

You have to link against Lbs.lib. See Reference here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文