Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User QtQueries's Avatar
    Join Date
    Feb 2011
    Posts
    24
    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
    Code:
    TARGET = MyMaps
    CONFIG += staticlib mobility
    MOBILITY += location
    I also have the following line in one of the .cpp files:
    Code:
    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
    Code:
    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:
    Code:
    Map {
        plugin: Plugin {
            name: "mymaps"
        }
    }
    I have tried including the line
    Code:
    Q_IMPORT_PLUGIN(MyMaps)
    in my application's main.cpp, however this will not build, I get the error:
    Code:
    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.

  2. #2
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Plugin is a shared object (library) by definition. In case you compile it as a static library then just add it to QML context.

  3. #3
    Registered User QtQueries's Avatar
    Join Date
    Feb 2011
    Posts
    24
    Quote Originally Posted by divanov View Post
    Plugin is a shared object (library) by definition.
    Which plugin? The one I'm writing?

    Quote Originally Posted by divanov View Post
    In case you compile it as a static library
    I think I'm already doing that bit OK...


    Quote Originally Posted by divanov View Post
    then just add it to QML context.
    Sorry I don't understand this part, how exactly do I do that?

    Thanks

  4. #4
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Quote Originally Posted by QtQueries View Post
    Which plugin? The one I'm writing?
    Like every plugin.

    Quote Originally Posted by QtQueries View Post
    I think I'm already doing that bit OK...
    If it's going so smoothly, why does this thead exist?

    Quote Originally Posted by QtQueries View Post
    Sorry I don't understand this part, how exactly do I do that?
    http://doc.qt.nokia.com/4.7/qdeclara...t.html#details

  5. #5
    Registered User QtQueries's Avatar
    Join Date
    Feb 2011
    Posts
    24
    Quote Originally Posted by divanov View Post
    If it's going so smoothly, why does this thead exist?
    Because I couldn't work out how to statically link it with my Qt application.

    My problem went away when changing
    Code:
    LIBS += \QtWorkspace\MyMaps-build-simulator\debug\libMyMaps.a
    to
    Code:
    LIBS += -L\QtWorkspace\MyMaps-build-simulator\debug -lMyMaps
    That works well for the simulator, but I now have a new problem in that I can't link it statically for a Symbian build. I will take that to a new thread.

    Thanks for the help anyway.

Similar Threads

  1. Route in Google Static MAP API
    By eling0167 in forum Geolocation and Navigation
    Replies: 6
    Last Post: 2011-11-17, 08:35
  2. [moved] Open source a simple Symbian C++ code with use Google static map API
    By zhang_guoqing in forum News, Announcements and Job Listings
    Replies: 8
    Last Post: 2010-09-16, 20:04
  3. Static Google Map in J2me
    By ajay.prajapati in forum Mobile Java Networking & Messaging & Security
    Replies: 9
    Last Post: 2009-04-09, 02:45
  4. Retrieveing map tiles in python
    By cassioli in forum Python
    Replies: 23
    Last Post: 2008-02-24, 20:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved