[PyKDE] Trouble binding code with SIP
Aurélien Gâteau
aurelien at dental-on-line.fr
Mon Oct 13 11:29:01 BST 2003
Hello list
I'm experimenting trouble binding some code with SIP. The original C++ header
code is composed of one namespace (DolSphinx) and a class
(DolSphinxListener). Here are some interesting excerpts:
--- dolsphinx.h ---
class DolSphinxListener;
namespace DolSphinx {
enum State {Uninitialized, Initializing, Listening, Calibrating, Paused};
/* Snipped some functions */
DolSphinxListener* listener();
void setListener(DolSphinxListener*);
State state();
State stringToState(const QString&);
QString stateToString(State);
}
---
The DolSphinxListener class:
--- dolsphinxlistener.h ---
class DolSphinxListener : public QObject {
Q_OBJECT
public:
/* Snipped some functions */
signals:
void wordHeard(const QString&);
void stateChanged(DolSphinx::State);
/* snip */
};
---
I wrote the following files to bind them:
--- dolsphinx.sip ---
%Module dolsphinx
%Import qtmod.sip
%HeaderCode
#include <dolsphinx.h>
%End
%Include dolsphinxlistener.sip
namespace DolSphinx {
enum State {Uninitialized, Initializing, Listening, Calibrating, Paused };
DolSphinxListener* listener();
void setListener(DolSphinxListener*);
DolSphinx::State state();
DolSphinx::State stringToState(const QString&);
QString stateToString(DolSphinx::State);
};
/* Snipped Makefile code */
---
--- dolsphinxlistener.h ---
class DolSphinxListener : QObject
{
%HeaderCode
#include <dolsphinxlistener.h>
%End
public:
signals:
void wordHeard(const QString&);
void stateChanged(DolSphinx::State);
};
---
Sip (3.7) generates correctly the C++ files, but compiling the generated files
fails with this error:
sipdolsphinxProxydolsphinx.h:22: `DolSphinx' was not declared in this scope
The offending line is:
void proxySlot(DolSphinx::State);
If I manually add a '#include <dolsphinx.h>' in this file, it works, but I
don't know how to tell sip to add this include itself. Does anyone got an
idea?
Please excuse my long message, I think it's necessary to include file excerpts
in order to find the problem.
Thanks in advance
Aurélien
More information about the PyQt
mailing list