Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Building with a static map tiles plugin in QML (Qt Mobility)
QtWS25 Last Chance

Building with a static map tiles plugin in QML (Qt Mobility)

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QtQueries
    wrote on last edited by
    #1

    Hi

    I have created a custom map tiles engine in C++, which works well when compiled as a dynamic library and imported into a QML app on the simulator.

    I wish however to have it as a static library, and bundle it in with my app... I can't get this to work.

    My plugin's .pro file has the following lines
    @
    TARGET = MyMaps
    CONFIG += staticlib mobility
    MOBILITY += location
    @

    I also have the following line in one of the .cpp files:
    @Q_EXPORT_PLUGIN2(MyMaps, QMyMappingProvider)@

    Building this seems to work OK, a libMyMaps.a file is produced.

    However I am having difficulty using it in my QML app.

    My QML app's .pro file has the following lines
    @LIBS += \QtWorkspace\MyMaps-build-simulator\debug\libMyMaps.a@

    It builds OK, but when I run it, it crashes when loading my QML file. It contains the following:
    @
    Map {
    plugin: Plugin {
    name: "mymaps"
    }
    }
    @

    I have tried including the line
    @Q_IMPORT_PLUGIN(MyMaps)@
    in my application's main.cpp, however this will not build, I get the error:
    @undefined reference to `qt_plugin_instance_MyMaps()'@

    Again, the plugin works well when included as a dynamic library!

    How can I bundle this static library with my app? Must I have it as a separate plugin? It would be much cleaner for me to have it all as one project.

    Help appreciated.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved