Qt Interface: undefined interface error

5.8k views Asked by At

I'm trying to write a plugin for KDevelop and I'm having an interface problem. Whenever I include QInterfaces(KDevelop::"Interface" I get an undefined interface error when doing the MOC step. Any ideas what going on? This also happens if I compile one of the kdevelop plugins as a single entity that was packaged with the kdevelop source code. I must be missing some linker option or library or something. Any ideas?

3

There are 3 answers

0
milahu On

i get error: Undefined interface from MOC when an include file is missing

// folder/subfolder/somewidget.h

#include "subfolder/someinterface.h" // (not found)

class SomeWidget : public ISomeInterface
{
    Q_OBJECT
    Q_INTERFACES(ISomeInterface) // error: Undefined interface

fixed by adding

# CMakeLists.txt

include_directories(folder)
0
Jan Struhar On

Occurred to me that I've got "Error: Undefined interface" from moc regarding file that was targeted towards multiple Qt versions.

#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
#else
#include <QDesignerCustomWidgetInterface>
#endif

The outcome was that C++ precompiler manages to evaluate QT_VERSION_CHECK macro, but moc does NOT. You need to re-phrase condition as direct version number

#if (QT_VERSION >= 0x050500)

this way C++ and moc can do the job and includes the file

0
Ahsan Nabi Khan On

Using Intellisense in VS 2010 when installing QVTK I get to the source of the error undefined interface: There is a reference to an include file which does not have the correct path set. Check all libraries includes that the path set is correct.