Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt statically linked to a library -> symbol(s) not found for architecture x86_64
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
@class Fields : public QObject
friend class ComponentManager;
QScriptValue scriptValue() const;
void bind(const QString name, QScriptValue control);
void set(const QString name, const QVariant value);
QVariant get(const QString name) const;
ComponentManager* const componentManager() const;
QScriptValue Fields::scriptValue() const
@ComponentManager::ComponentManager(QScriptEngine* const engine,
ScriptableWizard* const wizard,
Application* const application) :
s_instance = this;
m_scriptApiFields = new ScriptApi::Fields();
//! Delete the ComponentManager and all singletons created by it.
any ideas what i am missing?
thx in advance!
mmh, noone? still struggeling with this... suggestions appreciated...
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...
koahnig last edited by
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.
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.
koahnig last edited by
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++.
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.