views:

57

answers:

1

Hi everyone, 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.

+2  A: 

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

ur
i added following line in my .pro file `win32:LIBS += C:\NokiaQtSDK\Symbian\SDK\epoc32\release\armv5\lib\lbs.lib` but it didn't solve my problem. what did i do wrong?
fraktall
You're adding it as a win32 library, while you're missing a Symbian library. You need to do symbian:LIBS += llbs (with two l, the first for "library")
Teknolog