Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt statically linked to a library -> symbol(s) not found for architecture x86_64
Forum Updated to NodeBB v4.3 + New Features

Qt statically linked to a library -> symbol(s) not found for architecture x86_64

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 2 Posters 6.5k Views 1 Watching
  • 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.
  • H Offline
    H Offline
    hitme
    wrote on last edited by
    #1

    hey,

    i'm trying to implement a static library that uses qt.
    so far, i am able to build qt sources statically and link them to my library. as soon as i try to include the library to a main application i get several

    bq. Undefined symbols for architecture x86_64:
    "vtable for NI::NT::ScriptApi::Fields", referenced from:
    ScriptApi::Fields::Fields() in libNTFramework.a(Fields.o)
    ScriptApi::Fields::~Fields() in libNTFramework.a(Fields.o)
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    (...)
    ld: symbol(s) not found for architecture x86_64

    errors. when using qt built dynamically the errors do not occur.
    checking my library by using

    @lipo -info libNTFramework.a@

    output tells me that everything is built fine for the x86_64 arch:

    bq. Architectures in the fat file: (...)/libNTFramework.a are: x86_64 i386

    Fields.h:
    @class Fields : public QObject
    {
    Q_OBJECT
    friend class ComponentManager;

    public:
    QScriptValue scriptValue() const;

    public slots:
    void bind(const QString name, QScriptValue control);
    void set(const QString name, const QVariant value);
    QVariant get(const QString name) const;

    private:
    Fields();
    virtual ~Fields();

    QScriptValue m_scriptValue;
    ComponentManager* const componentManager() const;

    };@

    Fields.cpp:
    @Fields::Fields()
    {
    }

    Fields::~Fields()
    {
    }

    QScriptValue Fields::scriptValue() const
    {
    return m_scriptValue;
    }

    (...)@

    update:

    ComponentManager.cpp
    @ComponentManager::ComponentManager(QScriptEngine* const engine,
    ScriptableWizard* const wizard,
    Application* const application) :
    m_application(application),
    m_scriptEngine(engine),
    m_scriptableWizard(wizard)
    {
    s_instance = this;
    m_scriptApiFields = new ScriptApi::Fields();
    (...)
    }

    //! Delete the ComponentManager and all singletons created by it.
    ComponentManager::~ComponentManager()
    {
    delete m_scriptApiFields;
    (...)
    }
    (...)@

    any ideas what i am missing?
    thx in advance!

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hitme
      wrote on last edited by
      #2

      mmh, noone? still struggeling with this... suggestions appreciated...

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hitme
        wrote on last edited by
        #3

        is the the problem description too poor? or noone any experience with this? would be great if someone could lead me into the right direction...

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          welcome to devnet

          Why is your constructor and your destructor private?
          Typically those are public. You want make a special constructor private, if you want to exclude it from use. But there is no other one. I am not sure, if the destructor may be private at all.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hitme
            wrote on last edited by
            #5

            hi and thx for the welcome... "fields" is a singleton object that is created and managed in the friend class "componentmanager". i declared it private to make sure it is only created once/in the one friend class.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              I have no experience with singleton objects, but I am wondering how you are constructing a Fields object and how you want to destruct. You need to have a constructor even when managed in a friend class. At least in C++.

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hitme
                wrote on last edited by
                #7

                there is a constructor and the object is created/deleted the common way (see my initial post, i added some lines of ComponentManager.cpp). when using a library that contains the dynamically linked qt sources all goes fine, the application can be compiled/linked and executed.

                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