<div dir="ltr"><div>Problem solved ! Everything works fine now ! <br></div><div><br></div><div>Un très grand merci !</div><div><br></div><div>bitmap.kid<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 23 mars 2019 à 13:29, Phil Thompson <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The example is missing...<br>
<br>
%ModuleCode<br>
#include <hello.h><br>
%End<br>
<br>
Thanks,<br>
Phil<br>
<br>
> On 23 Mar 2019, at 12:09 pm, bitmap kid <<a href="mailto:bitmap.kid@gmail.com" target="_blank">bitmap.kid@gmail.com</a>> wrote:<br>
> <br>
> Oh obviously !<br>
> <br>
> hello.h ================================================<br>
> #ifndef HELLO_H<br>
> #define HELLO_H<br>
> #include <QLabel><br>
> #include <QWidget><br>
> #include <QString><br>
> <br>
> class Hello : public QLabel {<br>
> // This is needed by the Qt Meta-Object Compiler.<br>
> Q_OBJECT<br>
> <br>
> public:<br>
> Hello(QWidget *parent = 0);<br>
> <br>
> private:<br>
> // Prevent instances from being copied.<br>
> Hello(const Hello &);<br>
> Hello &operator=(const Hello &);<br>
> };<br>
> <br>
> #if !defined(Q_OS_WIN)<br>
> void setDefault(const QString &def);<br>
> #endif<br>
> #endif // HELLO_H<br>
> <br>
> hello.cpp ================================================<br>
> #include "hello.h"<br>
> <br>
> Hello::Hello(QWidget *parent): QLabel(parent) {}<br>
> Hello::Hello(const Hello &other) { (void) other; }<br>
> Hello &Hello::operator=(const Hello &other) { (void) other; return *this; }<br>
> <br>
> #if !defined(Q_OS_WIN)<br>
> void setDefault(const QString &def) { (void) def; }<br>
> #endif<br>
> <br>
> hello.sip ================================================<br>
> // Define the SIP wrapper to the hello library.<br>
> <br>
> %Module hello<br>
> <br>
> %Import QtGui/QtGuimod.sip<br>
> %Import QtWidgets/QtWidgetsmod.sip<br>
> <br>
> %If (Qt_5_0_0 -)<br>
> <br>
> class Hello : public QLabel {<br>
> <br>
> %TypeHeaderCode<br>
> #include <hello.h><br>
> %End<br>
> <br>
> public:<br>
> Hello(QWidget *parent /TransferThis/ = 0);<br>
> <br>
> private:<br>
> Hello(const Hello &);<br>
> };<br>
> <br>
> %If (!WS_WIN)<br>
> void setDefault(const QString &def);<br>
> %End<br>
> <br>
> %End<br>
> <br>
> <br>
> <br>
> <br>
> <br>
> Le sam. 23 mars 2019 à 13:05, Phil Thompson <<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>> a écrit :<br>
> On 23 Mar 2019, at 11:46 am, bitmap kid <<a href="mailto:bitmap.kid@gmail.com" target="_blank">bitmap.kid@gmail.com</a>> wrote:<br>
> > <br>
> > Bonjour,<br>
> > <br>
> > I'm trying to make the example "A More Complex C++ Example" given in the documentation. But I'm having trouble with the setDefault function.<br>
> > <br>
> > Once the sources generated with the sip command, when I compile, the compiler says:<br>
> > <br>
> > ./siphellocmodule.cpp:438:13: error: "setDefault" was not declared in this scope.<br>
> > setDefault (* a0);<br>
> > <br>
> > Indeed, the siphellocmodule.cpp file refers to the setDefault function but does not include hello.h<br>
> > <br>
> > Do you have an idea of where the problem is?<br>
> > <br>
> > Please, note :<br>
> > I am using PyQt5 5.12.1 and SIP 4.19.5.<br>
> > My project consists of hello.h, hello.cpp and hello.sip files<br>
> > My sip command is "sip -t WS_X11 -I /usr/share/sip/PyQt5 -c.hello.sip"<br>
> > It generates the following files:<br>
> > <br>
> > sipAPIhello.h<br>
> > siphelloHello.cpp<br>
> > siphellocmodule.cpp<br>
> > <br>
> > And commenting the setDefault function build the project correctly.<br>
> <br>
> Difficult to say without seeing your hello.h, hello.cpp and hello.sip.<br>
> <br>
> Phil<br>
<br>
</blockquote></div>