Re: C++ Base Class Not Recognized

William Tribley <[email protected]> Thu, 21 May 2026 21:32:31 -0500
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
--===============5307674778316985563==
Content-Type: multipart/alternative; 
	boundary="----=_Part_4934220_1244101158.1779417151542"

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

Hi William,

I found some of it. On a template I had a requires... statement which SWIG =
doesn't recognize. There was no warning.



At present some of the references to ModelSignalBase have the namespace, so=
me do not. I believe that it's having problems with nested namespace invoca=
tions.



At any rate, I have everything except this working now. Search/replace for =
namespace is trivial.=C2=A0



Thanks for your help,

Bill






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



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 < mailto:[email protected] >
To: "William Tribley"< mailto:[email protected] >
Cc: "swig-user"< mailto:[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_4934220_1244101158.1779417151542
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 style=3D"font-family: Verdana, Arial, Helvetica, s=
ans-serif; font-size: 12pt"><div>Hi William,<br></div><div>I found some of =
it. On a template I had a requires... statement which SWIG doesn't recogniz=
e. There was no warning.<br></div><div><br></div><div>At present some of th=
e references to ModelSignalBase have the namespace, some do not. I believe =
that it's having problems with nested namespace invocations.<br></div><div>=
<br></div><div>At any rate, I have everything except this working now. Sear=
ch/replace for namespace is trivial.&nbsp;<br></div><div><br></div><div>Tha=
nks for your help,<br></div><div>Bill</div><div><br></div><div class=3D"x_7=
46388530zmail_extra_hr" style=3D"border-top: 1px solid rgb(204, 204, 204); =
min-height: 0px; margin-top: 10px; margin-bottom: 10px; line-height: 0px"><=
br></div><div class=3D"x_746388530zmail_extra"><div><br></div><div id=3D"x_=
7463885301">From: William Tribley &lt;<a href=3D"mailto:[email protected]" t=
arget=3D"_blank">[email protected]</a>&gt;<br>To: "William S Fulton"&lt;<a h=
ref=3D"mailto:[email protected]" target=3D"_blank">wsf@fultondesigns.=
co.uk</a>&gt;<br>Cc: "swig-user"&lt;<a href=3D"mailto:[email protected]=
eforge.net" target=3D"_blank">[email protected]</a>&gt;<br>Da=
te: Thu, 14 May 2026 18:08:34 -0500<br>Subject: Re: [Swig-user] C++ Base Cl=
ass Not Recognized<br></div><div><br></div><blockquote id=3D"x_746388530blo=
ckquote_zmail" style=3D"margin: 0px"><div><div style=3D"font-family: Verdan=
a, Arial, Helvetica, sans-serif; font-size: 12pt"><div>Hi William,<br></div=
><div>Thank you for your response. I'll take another look at this next week=
. Fighting std_vector and std_unordered_list wars today...<br></div><div>Ha=
ve a good weekend,<br></div><div>Bill<br></div><div><br></div><div style=3D=
"border-top: 1px solid rgb(204, 204, 204); min-height: 0px; margin-top: 10p=
x; margin-bottom: 10px; line-height: 0px" class=3D"x_746388530x_1236332122z=
mail_extra_hr"><br></div><div class=3D"x_746388530x_1236332122zmail_extra">=
<div><br></div><div id=3D"x_12363321221">From: William S Fulton &lt;<a targ=
et=3D"_blank" href=3D"mailto:[email protected]">[email protected].=
uk</a>&gt;<br>To: "William Tribley"&lt;<a target=3D"_blank" href=3D"mailto:=
[email protected]">[email protected]</a>&gt;<br>Cc: "swig-user"&lt;<a target=
=3D"_blank" href=3D"mailto:[email protected]">swig-user@lists=
.sourceforge.net</a>&gt;<br>Date: Thu, 14 May 2026 16:45:40 -0500<br>Subjec=
t: Re: [Swig-user] C++ Base Class Not Recognized<br></div><div><br></div><b=
lockquote style=3D"margin: 0px" id=3D"x_1236332122blockquote_zmail"><div><d=
iv dir=3D"ltr"><div>You don't show all the inputs. You should fully qualify=
 the types in %template. If that doesn't work write a simple reproducible e=
xample and post here.<br></div><div><br></div><div>William<br></div></div><=
br><div class=3D"x_746388530x_1236332122x_1693699173gmail_quote x_746388530=
x_1236332122x_1693699173gmail_quote_container"><div dir=3D"ltr" class=3D"x_=
746388530x_1236332122x_1693699173gmail_attr">On Tue, 12 May 2026 at 21:41, =
William Tribley &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">b=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"x_746388530x_1=
236332122x_1693699173gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex">Greetings,<br> I h=
ave this c++ code:<br> <br> <br> namespace ModelAPI<br> {<br> &nbsp; &nbsp;=
 &nbsp; &nbsp; class ModelSignalBase<br> &nbsp; &nbsp; &nbsp; &nbsp; {<br> =
&nbsp; &nbsp; &nbsp; &nbsp; public:<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; ModelSignalBase() <br> &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp; &nbsp; { <br> ....<br> <br> &nbsp; &nbsp; &nbsp; &nbsp; c=
lass ModelSignal : public ModelSignalBase<br> &nbsp; &nbsp; &nbsp; &nbsp; {=
<br> &nbsp; &nbsp; &nbsp; &nbsp; public:<br> &nbsp; &nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;<br> &nbsp; &nbsp; &nbsp; &nbs=
p; &nbsp; &nbsp; &nbsp; &nbsp; /// Copy constructor.<br> &nbsp; &nbsp; &nbs=
p; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;<br> &nbsp; &nbsp=
; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /// &lt;param name=3D"ms"&gt;Mo=
delSignal to copy.&lt;/param&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &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_modelSignals_1set(JNIEnv *=
jenv, jclass jcls, jlong jarg1) {<br> &nbsp; std::vector&lt; ModelSignalBas=
e * &gt; arg1 ;<br> &nbsp; std::vector&lt; ModelSignalBase * &gt; *argp1 ;<=
br> <br> &nbsp; (void)jenv;<br> &nbsp; (void)jcls;<br> &nbsp; argp1 =3D *(s=
td::vector&lt; ModelSignalBase * &gt; **)&amp;jarg1; <br> &nbsp; if (!argp1=
) {<br> ...<br> <br> The entire class structure that I'm wrapping in SWIG i=
s in namespace ModelAPI. The code compiles and runs in C++.<br> <br> Any hi=
nts or ideas appreciated.<br> <br> Best regards,<br> Bill<br> <br> <br> ___=
____________________________________________<br> Swig-user mailing list<br>=
 <a href=3D"mailto:[email protected]" target=3D"_blank">Swig-=
[email protected]</a><br> <a href=3D"https://lists.sourceforge.net=
/lists/listinfo/swig-user" target=3D"_blank">https://lists.sourceforge.net/=
lists/listinfo/swig-user</a><br></blockquote></div></div></blockquote></div=
><div><br></div></div><br></div></blockquote></div><div><br></div></div></d=
iv><br></body></html>
------=_Part_4934220_1244101158.1779417151542--



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


--===============5307674778316985563==
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

--===============5307674778316985563==--