Reply
Thread Tools
Posts: 124 | Thanked: 10 times | Joined on Jan 2007 @ Italy
#1
hi! i'm trying to start with qt development, but i've some serious problem with nokia qt sdk

everything seems to work fine using generic qt classes, but something wrong happens when i try to use qtmobility classes

I'm trying to use QGeoPositionInfo but:
Code:
undefined reference to `MainWindow::positionUpdated(QtMobility::QGeoPositionInfo&)'
and this happens with every qtmobility class!

what's wrong? is not qtmobility already embedded in nokia qt sdk?

i hope you can help me!!
thanks
 
Posts: 190 | Thanked: 129 times | Joined on Mar 2010 @ Bavaria, Germany
#2
Did you add the following to your .pro file?
Code:
CONFIG += mobility
MOBILITY += location
Edit:
Ooops, the error message means you have declared positionUpdated() in your header but didn't implement it in the .cpp (or it has a different signature).
 

The Following 2 Users Say Thank You to gri For This Useful Post:
Posts: 1,086 | Thanked: 2,964 times | Joined on Jan 2010
#3
I thought I read that QtMobility is not included. The package might be available in extras repo, I believe they are all final except the Multimedia API which is still in development stage.

Edit: nup, i just googled and it's saying QtMobility 1.0.0 is included with the sdk, so ignore anything i said

Last edited by kojacker; 2010-05-18 at 20:52.
 

The Following User Says Thank You to kojacker For This Useful Post:
Posts: 124 | Thanked: 10 times | Joined on Jan 2007 @ Italy
#4
Originally Posted by gri View Post
Did you add the following to your .pro file?
Code:
CONFIG += mobility
MOBILITY += location
Edit:
Ooops, the error message means you have declared positionUpdated() in your header but didn't implement it in the .cpp (or it has a different signature).
.pro file seems to be ok!

about positionUpdated():
Code:
    void positionUpdated(QGeoPositionInfo &info);
Code:
void positionUpdated(QGeoPositionInfo &info)
       {
           qDebug() << "Position updated:" << info;
       }
so what?
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#5
Either set the proper namespace or keep the QtMobility:: class specifier.
 

The Following User Says Thank You to Joorin For This Useful Post:
Posts: 124 | Thanked: 10 times | Joined on Jan 2007 @ Italy
#6
Originally Posted by Joorin View Post
Either set the proper namespace or keep the QtMobility:: class specifier.
I'm using:
Code:
   using namespace QtMobility;
btw same problem keeping class specifier
 
Posts: 190 | Thanked: 129 times | Joined on Mar 2010 @ Bavaria, Germany
#7
Originally Posted by saxen View Post
.pro file seems to be ok!

about positionUpdated():
Code:
    void positionUpdated(QGeoPositionInfo &info);
Code:
void positionUpdated(QGeoPositionInfo &info)
       {
           qDebug() << "Position updated:" << info;
       }
so what?
If the lower one is really your code, it should be:
Code:
void MainWindow::positionUpdated(QGeoPositionInfo &info)
       {
           qDebug() << "Position updated:" << info;
       }
Edit: Also please change the parameter to const QGeoPositionInfo& info. Non-const references are generally bad in signal/slots.

Last edited by gri; 2010-05-18 at 21:27.
 

The Following 2 Users Say Thank You to gri For This Useful Post:
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#8
Ok, now I'm just guessing:

In your .h file, did you really declare the positionUpdated method like that?

And in your .cpp file, just like above? Because you typically need to prepend the method name with the class name in the definition, like so:
Code:
void YourClass::positionUpdated() { ...}
Otherwise the compiler won't find the method that matches the declaration in the .h file.
 
Posts: 124 | Thanked: 10 times | Joined on Jan 2007 @ Italy
#9


ok, i'm feeling so stupid
sorry but i'm new with c++, i've worked and Java, and it doesn't need to use class name in method definition!

so, ok...it works now! i've just spent last two hours thinking about it, thank you so much
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#10
Just a simple advice for the future: the compiler is your friend. Even though the C++ compilers typically suck at telling you what's wrong, it's almost always in the printouts.

(And the compilers suck at it because C++ is overcomplicated and badly designed, sadly.)
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 09:19.