Re: C++ Base Class Not Recognized

William Tribley <[email protected]> Thu, 14 May 2026 18:08:34 -0500
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
--===============4363522872745284098==
Content-Type: multipart/alternative; 
	boundary="----=_Part_8476444_431859581.1778800114116"

------=_Part_8476444_431859581.1778800114116
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi William,

Thank you for your response. I'll take another look at this next week. Figh=
ting std_vector and std_unordered_list wars today...

Have a good weekend,

Bill






From: William S Fulton <[email protected]>
To: "William Tribley"<[email protected]>
Cc: "swig-user"<[email protected]>
Date: Thu, 14 May 2026 16:45:40 -0500
Subject: Re: [Swig-user] C++ Base Class Not Recognized



You don't show all the inputs. You should fully qualify the types in %templ=
ate. If that doesn't work write a simple reproducible example and post here=
.



William



On Tue, 12 May 2026 at 21:41, William Tribley < mailto:[email protected] > w=
rote:

Greetings,
 I have this c++ code:
=20
=20
 namespace ModelAPI
 {
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 class ModelSignalBase
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 public:
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ModelSignalBase()=
=20
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {=20
 ....
=20
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 class ModelSignal : public ModelSignalBase
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 public:
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /// <summary>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /// Copy construct=
or.
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /// </summary>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /// <param name=3D=
"ms">ModelSignal to copy.</param>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ModelSignal(const =
ModelSignal& ms)
 ....
=20
=20
 In the generated cxx file the namespace is not included:
=20
 ...
 SWIGEXPORT void JNICALL Java_TiwsModelApiJNI_modelSignals_1set(JNIEnv *jen=
v, jclass jcls, jlong jarg1) {
 =C2=A0 std::vector< ModelSignalBase * > arg1 ;
 =C2=A0 std::vector< ModelSignalBase * > *argp1 ;
=20
 =C2=A0 (void)jenv;
 =C2=A0 (void)jcls;
 =C2=A0 argp1 =3D *(std::vector< ModelSignalBase * > **)&jarg1;=20
 =C2=A0 if (!argp1) {
 ...
=20
 The entire class structure that I'm wrapping in SWIG is in namespace Model=
API. The code compiles and runs in C++.
=20
 Any hints or ideas appreciated.
=20
 Best regards,
 Bill
=20
=20
 _______________________________________________
 Swig-user mailing list
 mailto:[email protected]=20
 https://lists.sourceforge.net/lists/listinfo/swig-user
------=_Part_8476444_431859581.1778800114116
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>=
<meta content=3D"text/html;charset=3DUTF-8" http-equiv=3D"Content-Type"></h=
ead><body ><div style=3D"font-family: Verdana, Arial, Helvetica, sans-serif=
; font-size: 12pt;"><div>Hi William,<br></div><div>Thank you for your respo=
nse. I'll take another look at this next week. Fighting std_vector and std_=
unordered_list wars today...<br></div><div>Have a good weekend,<br></div><d=
iv>Bill</div><div><br></div><div class=3D"zmail_extra_hr" style=3D"border-t=
op: 1px solid rgb(204, 204, 204); height: 0px; margin-top: 10px; margin-bot=
tom: 10px; line-height: 0px;"><br></div><div class=3D"zmail_extra" data-zbl=
uepencil-ignore=3D"true"><div><br></div><div id=3D"Zm-_Id_-Sgn1">From: Will=
iam S Fulton &lt;[email protected]&gt;<br>To: "William Tribley"&lt;bi=
[email protected]&gt;<br>Cc: "swig-user"&lt;[email protected]&gt=
;<br>Date: Thu, 14 May 2026 16:45:40 -0500<br>Subject: Re: [Swig-user] C++ =
Base Class Not Recognized<br></div><div><br></div><blockquote id=3D"blockqu=
ote_zmail" style=3D"margin: 0px;"><div><div dir=3D"ltr"><div>You don't show=
 all the inputs. You should fully qualify the types in %template. If that d=
oesn't work write a simple reproducible example and post here.<br></div><di=
v><br></div><div>William<br></div></div><br><div class=3D"x_1693699173gmail=
_quote x_1693699173gmail_quote_container"><div class=3D"x_1693699173gmail_a=
ttr" dir=3D"ltr">On Tue, 12 May 2026 at 21:41, William Tribley &lt;<a targe=
t=3D"_blank" href=3D"mailto:[email protected]">[email protected]</a>&gt; wrot=
e:<br></div><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1p=
x solid rgb(204, 204, 204); padding-left: 1ex" class=3D"x_1693699173gmail_q=
uote">Greetings,<br> I have this c++ code:<br> <br> <br> namespace ModelAPI=
<br> {<br> &nbsp; &nbsp; &nbsp; &nbsp; class ModelSignalBase<br> &nbsp; &nb=
sp; &nbsp; &nbsp; {<br> &nbsp; &nbsp; &nbsp; &nbsp; public:<br> &nbsp; &nbs=
p; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ModelSignalBase() <br> &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { <br> ....<br> <br> &nbsp=
; &nbsp; &nbsp; &nbsp; class ModelSignal : public ModelSignalBase<br> &nbsp=
; &nbsp; &nbsp; &nbsp; {<br> &nbsp; &nbsp; &nbsp; &nbsp; public:<br> &nbsp;=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br> &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// Copy constructor=
.<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summ=
ary&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &lt=
;param name=3D"ms"&gt;ModelSignal to copy.&lt;/param&gt;<br> &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ModelSignal(const ModelSignal&amp=
; ms)<br> ....<br> <br> <br> In the generated cxx file the namespace is not=
 included:<br> <br> ...<br> SWIGEXPORT void JNICALL Java_TiwsModelApiJNI_mo=
delSignals_1set(JNIEnv *jenv, jclass jcls, jlong jarg1) {<br> &nbsp; std::v=
ector&lt; ModelSignalBase * &gt; arg1 ;<br> &nbsp; std::vector&lt; ModelSig=
nalBase * &gt; *argp1 ;<br> <br> &nbsp; (void)jenv;<br> &nbsp; (void)jcls;<=
br> &nbsp; argp1 =3D *(std::vector&lt; ModelSignalBase * &gt; **)&amp;jarg1=
; <br> &nbsp; if (!argp1) {<br> ...<br> <br> The entire class structure tha=
t I'm wrapping in SWIG is in namespace ModelAPI. The code compiles and runs=
 in C++.<br> <br> Any hints or ideas appreciated.<br> <br> Best regards,<br=
> Bill<br> <br> <br> _______________________________________________<br> Sw=
ig-user mailing list<br> <a target=3D"_blank" href=3D"mailto:Swig-user@list=
s.sourceforge.net">[email protected]</a><br> <a target=3D"_bl=
ank" href=3D"https://lists.sourceforge.net/lists/listinfo/swig-user">https:=
//lists.sourceforge.net/lists/listinfo/swig-user</a><br></blockquote></div>=
</div></blockquote></div><div><br></div></div><br></body></html>
------=_Part_8476444_431859581.1778800114116--



--===============4363522872745284098==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============4363522872745284098==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user

--===============4363522872745284098==--