Re: C++ Base Class Not Recognized
William S Fulton <[email protected]> Thu, 14 May 2026 22:45:40 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANGqftBCCD4mUeD0MKEyO_eg5kT_K2GuoT-TPsAUQX8LtzgS0w@mail.gmail.com> |
--===============2056655683559459422== Content-Type: multipart/alternative; boundary="000000000000a5ca890651ce06c3" --000000000000a5ca890651ce06c3 Content-Type: text/plain; charset="UTF-8" You don't show all the inputs. You should fully qualify the types in %template. If that doesn't work write a simple reproducible example and post here. William On Tue, 12 May 2026 at 21:41, William Tribley <[email protected]> wrote: > Greetings, > I have this c++ code: > > > namespace ModelAPI > { > class ModelSignalBase > { > public: > ModelSignalBase() > { > .... > > class ModelSignal : public ModelSignalBase > { > public: > /// <summary> > /// Copy constructor. > /// </summary> > /// <param name="ms">ModelSignal to copy.</param> > ModelSignal(const ModelSignal& ms) > .... > > > In the generated cxx file the namespace is not included: > > ... > SWIGEXPORT void JNICALL Java_TiwsModelApiJNI_modelSignals_1set(JNIEnv > *jenv, jclass jcls, jlong jarg1) { > std::vector< ModelSignalBase * > arg1 ; > std::vector< ModelSignalBase * > *argp1 ; > > (void)jenv; > (void)jcls; > argp1 = *(std::vector< ModelSignalBase * > **)&jarg1; > if (!argp1) { > ... > > The entire class structure that I'm wrapping in SWIG is in namespace > ModelAPI. The code compiles and runs in C++. > > Any hints or ideas appreciated. > > Best regards, > Bill > > > _______________________________________________ > Swig-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/swig-user > --000000000000a5ca890651ce06c3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>You don't show all the inputs. You should fully q= ualify the types in %template. If that doesn't work write a simple repr= oducible example and post here.</div><div><br></div><div>William</div></div= ><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" clas= s=3D"gmail_attr">On Tue, 12 May 2026 at 21:41, William Tribley <<a href= =3D"mailto:[email protected]">[email protected]</a>> wrote:<br></div><bloc= kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:= 1px solid rgb(204,204,204);padding-left:1ex">Greetings,<br> I have this c++ code:<br> <br> <br> namespace ModelAPI<br> {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 class ModelSignalBase<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 public:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ModelSignalBase() <= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 { <br> ....<br> <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 class ModelSignal : public ModelSignalBase<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 public:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /// <summary>= <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /// Copy constructo= r.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /// </summary>= ;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /// <param name= =3D"ms">ModelSignal to copy.</param><br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ModelSignal(const M= odelSignal& 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> =C2=A0 std::vector< ModelSignalBase * > arg1 ;<br> =C2=A0 std::vector< ModelSignalBase * > *argp1 ;<br> <br> =C2=A0 (void)jenv;<br> =C2=A0 (void)jcls;<br> =C2=A0 argp1 =3D *(std::vector< ModelSignalBase * > **)&jarg1; <b= r> =C2=A0 if (!argp1) {<br> ...<br> <br> The entire class structure that I'm wrapping in SWIG is in namespace Mo= delAPI. The code compiles and runs in C++.<br> <br> Any hints 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-u= [email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/swig-user" rel=3D"n= oreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/s= wig-user</a><br> </blockquote></div> --000000000000a5ca890651ce06c3-- --===============2056655683559459422== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============2056655683559459422== 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 --===============2056655683559459422==--