Qt statically linked to a library -> symbol(s) not found for architecture x86_64
-
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 severalbq. 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_64errors. 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! -
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. -
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.