Error Building interface in Qt 5.1
-
I am attempting to build an interface and implementation in Qt 5.1
My interface class foo.hpp
@
#ifndef FOO_HPP
#define FOO_HPP
#include <QtCore/QtPlugin>class Foo // defined interface to my implementation base class
{public:
// my virtual interface functions
virtual void init();
};
#define Foo_iid "com.myproj.Foo"
Q_DECLARE_INTERFACE(Foo, Foo_iid)
@my base class definition FooBase.h
@
#include "foo.h"class FooBase : public QObject, public Foo
{
// Implementation of the Foo interface class
Q_OBJECT
Q_INTERFACES(Foo)public:
explicit FooBase(QObject *parent=0);void init();
};
@my implementation base code foobase.cpp
@
FooBase::FooBase(QObject *parent) : QObject(parent), Foo()
{
//
}void init()
{
// code to initialize foo
}
@my project file foo.pro
@
TEMPLATE = lib
TARGET = foo
DESTDIR = ../libQT += core gui widgets printsupport network
CONFIG += qt thread exceptions resources qwt shared
unix: { CONFIG += x11 }
windows: { CONFIG += windows }OBJECTS_DIR = obj
MOC_DIR = moc
RCC_DIR = rccHEADERS += foo.hpp foobase.hpp
SOURCES += foobase.cpp
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
}
@The compile in QtCreator returns only 3 errors that are rather cryptic and need to know what it means and what to look for -
errno: TLS definition in /lib/i386-linux-gnu/libc.so.6 section .tbss mismatches non-TLS definition in obj/winmorbase.o section .bss
/lib/i386-linux-gnu/libc.so.6:-1: error: could not read symbols: Bad value
error: collect2: error: ld returned 1 exit statusThe last error line I understand as I have seen in numerous times. It is the first two that have me stumped.
Can anyone help?
-
Hi,
Since you are defining an interface your init() function should be pure virtual
@virtual void init() = 0;@
-
I am missing something. The foo.h interface definition does have the pure virtual function as virtual void init(). The only thing different is that it is not initialized in the same way.
Will this illicit the error I am seeing?
-
-
I found a typo to cause the error mentioned. Now there are a whole bunch of new vtable errors for some reason. Checking.
-
vtable errors a generally there when adding or removing Q_OBJECT from a class and rebuilding without running qmake