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 <[email protected]><br>To: "William Tribley"<bi= [email protected]><br>Cc: "swig-user"<[email protected]>= ;<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 <<a targe= t=3D"_blank" href=3D"mailto:[email protected]">[email protected]</a>> 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> class ModelSignalBase<br> &nb= sp; {<br> public:<br> &nbs= p; ModelSignalBase() <br> = { <br> ....<br> <br>  = ; class ModelSignal : public ModelSignalBase<br>  = ; {<br> public:<br> = /// <summary><br> &= nbsp; /// Copy constructor= .<br> /// </summ= ary><br> /// <= ;param name=3D"ms">ModelSignal to copy.</param><br> = ModelSignal(const ModelSignal&= ; 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> std::v= ector< ModelSignalBase * > arg1 ;<br> std::vector< ModelSig= nalBase * > *argp1 ;<br> <br> (void)jenv;<br> (void)jcls;<= br> argp1 =3D *(std::vector< ModelSignalBase * > **)&jarg1= ; <br> 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==--