0

I’m trying to use QtLocation but I can’t! I don’t realise why! I’m using qt5.3.2 with ubuntu 14.04. it’s strange because I added this lines to my .pro file:

QT       += network
CONFIG   += mobility
MOBILITY  += location

and it’s qmake successfully. nad I checked my qt5 libraries and I can find this library but still I can’t use it!

it’s not recognize my includes and print errors like this:

QGeoCoordinate: No such file or directory

and int’s not the only include that it’s not recognize. generally it’s not recognize QGeo types!

Cœur
  • 37,241
  • 25
  • 195
  • 267
HMD
  • 2,202
  • 6
  • 24
  • 37

2 Answers2

3

TL;DR: add this to your .pro file:

QT += positioning

The QGeo* classes (and QNmeaPositionInfoSource) are bundled in their own library, which need to be referenced as above.

Apart from that, the "MOBILITY" and "CONFIG" statements look like some relic from Qt4, the line above should be enough.

Peter Ha
  • 321
  • 2
  • 6
  • yes you I are right. I realized it about an hour ago. but this positioning is so limited and it cant help me! do you know how to add QtLocation to qt5? I can find it's module but I can't qmake it! it has some errors. – HMD Feb 18 '15 at 12:14
  • by adding "QT += location" to the .pro file? – Peter Ha Feb 18 '15 at 13:16
  • no! by adding QtLocation module from [here](http://qt-project.org/wiki/Qt-Add-ons-Modules). I can download it but I can't add it!! – HMD Feb 18 '15 at 13:26
2

In cmake use:

CMakeLists.txt

find_package(Qt5 COMPONENTS Positioning REQUIRED)

target_link_libraries(<executable> Qt5::Positioning)
eyllanesc
  • 235,170
  • 19
  • 170
  • 241