<div dir="ltr"><div dir="ltr"><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">Maybe, the complete history of my commands will help you:</span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-">[th@mecanic ~/sip] ls<br>hello.cpp hello.h hello.sip main.cpp<br>[th@mecanic ~/sip] sip -t WS_X11 -I /usr/share/sip/PyQt5 -c . hello.sip <br>[th@mecanic ~/sip] /usr/bin/g++ -DDEBUG -DHOST -DQT_CORE_LIB -DQT_GUI_LIB -Dserver_EXPORTS -I. -I../ -Iserver_autogen/include -I../. -I/usr/include/python3.7m -isystem /usr/include/qt -isystem /usr/include/qt/QtCore -isystem /usr/lib/qt/mkspecs/linux-g++ -g -fPIC -Wall -pedantic -fPIC -std=gnu++17 -MD -I /usr/include/qt/QtWidgets/ -I /usr/include/qt/QtGui/ -c *.cpp<br>./siphellocmodule.cpp: Dans la fonction « PyObject* func_setDefault(PyObject*, PyObject*) »:<br>./siphellocmodule.cpp:438:13: error: « setDefault » n'a pas été déclaré dans cette portée<br> setDefault(*a0);<br> ^~~~~~~~~~<br>./siphellocmodule.cpp:438:13: note: alternatives suggérées: « func_setDefault »<br> setDefault(*a0);<br> ^~~~~~~~~~<br> func_setDefault<br></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></div><div><span class="gmail-tlid-translation gmail-translation" lang="en"><span title="" class="gmail-"><br></span></span></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 23 mars 2019 à 13:09, bitmap kid <<a href="mailto:bitmap.kid@gmail.com">bitmap.kid@gmail.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"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-">Oh obviously !</span></span></div><div dir="ltr"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><br></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-">hello.h ================================================<br></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-">#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></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-">hello.cpp ================================================</span></span></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-">#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</span></span></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><br></span></span></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-">hello.sip ================================================</span></span></span></span></span></span></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-">// 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></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><br></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><br></span></span></div><div><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><br></span></span></div><div dir="ltr"><span class="gmail-m_-3513500581126057286gmail-tlid-translation gmail-m_-3513500581126057286gmail-translation" lang="en"><span title="" class="gmail-m_-3513500581126057286gmail-"><br></span></span></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 23 mars 2019 à 13:05, Phil Thompson <<a href="mailto:phil@riverbankcomputing.com" target="_blank">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">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</blockquote></div>
</blockquote></div>