error: QGeoLocation: No such file or directory



  • Hi,

    I tried to #include <QGeoLocation> but I keep getting :

    error: QGeoLocation: No such file or directory
    #include <QGeoLocation>
    ^

    The .pro includes location

    QT += core gui location positioning

    Why am I getting the error?



  • @WhatIf
    What the Qt Version using?

    After adding the QT+ = positioning , did u run "qmake" again?



  • Qt Creator 3.5.1

    After adding QT+ = positioning, I clicked the run button.



  • @WhatIf

    Qt Creator does not matter, Qt Version has to be minimum 5.2 to use QGeoLocation.

    First try this:
    After adding QT+ = positioning , you must run first qmake. Right click on the "project name" and "Run qmake" , and then build , run.



  • Based on Qt 5.5.1 (MSVC 2013, 32 bit)

    I right clicked on the "project name" and "Run qmake", no problems.

    When I click build, I get the same error.



  • @WhatIf

    I don't see any error. Check all spellings correctly. I tested with the same kit Qt 5.5.1 (MSVC 2013, 32 bit). I dont have any issue.

    Try to make new sample project and add QT += core gui location positioning & #include <QtLocation>
    #include <QGeoLocation> .

    Still if you get error, Could you copy and paste the exact error here.



  • C:\Users\Mike\Documents\Map\mainwindow.cpp:8: error: QGeoLocation: No such file or directory
    #include <QGeoLocation>
    ^

    These are all my #includes:

    #include <QGeoAddress>
    #include <QGeoRoute>
    #include <QGeoLocation>
    #include <QGeoShape>
    #include <QGeoServiceProvider>
    #include <QGeoCodingManager>
    #include <QGeoCodeReply>

    I included #include <QtLocation>, still the same problem.

    deleted the project and started over, still the same problem.



  • Hi! Go to the installation directory and make sure the header files are actually there, e.g. in /opt/Qt5.7/5.7/gcc_64/include/QtPositioning.



  • From the following list:

    #include <QGeoAddress>
    #include <QGeoRoute>
    #include <QGeoLocation>
    #include <QGeoShape>
    #include <QGeoServiceProvider>
    #include <QGeoCodingManager>
    #include <QGeoCodeReply>

    only qgeoaddress and qgeoshape are in the QtPositioning folder. Is there a way to update Qt creator or download them? I downloaded and installed Qt creator a few months ago.



  • You can run the Qt Maintainance Tool to install / reinstall said modules.



  • Although, if possible, updating to 5.7 would be preferable.



  • Finally, it's working :)

    Thank you very much!



  • @WhatIf Great to hear. Please mark the thread as solved (as described here). How did you solve it?



  • Qt Maintenance Tool > Add or remove components > expand Qt 5.5 > expand source compnonets > expand Add-Ons and select qtlocation > click update


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.