sdg::pair<int,int>

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

sdg::pair<int,int>

Aaron Dalton
I am getting the following error while parsing a .h file (Swig v1.3.7).

/usr/local/include/DungeonMaker.h:32: Warning(401): Nothing known about
base class 'std::pair<int,int >'. Ignored.
/usr/local/include/DungeonMaker.h:32: Warning(401): Maybe you forgot to
instantiate 'std::pair<int,int >' using %template.

The actual declaration is:
#include <utility>
struct IntCoordinate : std::pair<int , int>

The .i file also includes std_pair.i.  I don't have this problem with
the std::vectors in the file.  Any ideas?  Thanks!

--
Aaron Dalton       |   Super Duper Games
[hidden email]   |   http://superdupergames.org


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: sdg::pair<int,int>

Marcelo Matus
Use:
----------------------------------------
%module mymodule

%include <std_pair.i>

%template(pair_ii) std::pair<int,int>;

%{
#include "myheader.h"
%}

%include "myheader.h"
----------------------------------------

ie, use the %template directive before you include your class declaration.

Marcelo


Aaron Dalton wrote:

> I am getting the following error while parsing a .h file (Swig v1.3.7).
>
> /usr/local/include/DungeonMaker.h:32: Warning(401): Nothing known
> about base class 'std::pair<int,int >'. Ignored.
> /usr/local/include/DungeonMaker.h:32: Warning(401): Maybe you forgot
> to instantiate 'std::pair<int,int >' using %template.
>
> The actual declaration is:
> #include <utility>
> struct IntCoordinate : std::pair<int , int>
>
> The .i file also includes std_pair.i.  I don't have this problem with
> the std::vectors in the file.  Any ideas?  Thanks!
>



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: sdg::pair<int,int>

Matthias-54
In reply to this post by Aaron Dalton
On Wed, 16 Nov 2005 03:58:00 +0100, Aaron Dalton <[hidden email]> wrote:

> I am getting the following error while parsing a .h file (Swig v1.3.7).
>
> /usr/local/include/DungeonMaker.h:32: Warning(401): Nothing known about  
> base class 'std::pair<int,int >'. Ignored.
> /usr/local/include/DungeonMaker.h:32: Warning(401): Maybe you forgot to  
> instantiate 'std::pair<int,int >' using %template.
>
> The actual declaration is:
> #include <utility>
> struct IntCoordinate : std::pair<int , int>
>
> The .i file also includes std_pair.i.  I don't have this problem with  
> the std::vectors in the file.  Any ideas?  Thanks!
>

You should have a

%template (IntIntPair) std::pair<int, int>;

somewhere in your .i file.


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: sdg::pair<int,int>

Aaron Dalton
In reply to this post by Marcelo Matus
Marcelo Matus wrote:

> Use:
> ----------------------------------------
> %module mymodule
>
> %include <std_pair.i>
>
> %template(pair_ii) std::pair<int,int>;
>
> %{
> #include "myheader.h"
> %}
>
> %include "myheader.h"
> ----------------------------------------
>
> ie, use the %template directive before you include your class declaration.
>
> Marcelo
>
>
> Aaron Dalton wrote:
>
>> I am getting the following error while parsing a .h file (Swig v1.3.7).
>>
>> /usr/local/include/DungeonMaker.h:32: Warning(401): Nothing known
>> about base class 'std::pair<int,int >'. Ignored.
>> /usr/local/include/DungeonMaker.h:32: Warning(401): Maybe you forgot
>> to instantiate 'std::pair<int,int >' using %template.
>>
>> The actual declaration is:
>> #include <utility>
>> struct IntCoordinate : std::pair<int , int>
>>
>> The .i file also includes std_pair.i.  I don't have this problem with
>> the std::vectors in the file.  Any ideas?  Thanks!
>>
>

Thank you, Marcelo.  I was sure I tried this earlier with the same
error, but it works now.  *shakes his head in confusion*  Why is it that
I do not have to do this with my std::vectors as well?

--
Aaron Dalton       |   Super Duper Games
[hidden email]   |   http://superdupergames.org


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: sdg::pair<int,int>

Marcelo Matus
Aaron Dalton wrote:

> Marcelo Matus wrote:
>
>> Use:
>> ----------------------------------------
>> %module mymodule
>>
>> %include <std_pair.i>
>>
>> %template(pair_ii) std::pair<int,int>;
>>
>> %{
>> #include "myheader.h"
>> %}
>>
>> %include "myheader.h"
>> ----------------------------------------
>>
>> ie, use the %template directive before you include your class
>> declaration.
>>
>> Marcelo
>>
>>
>> Aaron Dalton wrote:
>>
>>> I am getting the following error while parsing a .h file (Swig v1.3.7).
>>>
>>> /usr/local/include/DungeonMaker.h:32: Warning(401): Nothing known
>>> about base class 'std::pair<int,int >'. Ignored.
>>> /usr/local/include/DungeonMaker.h:32: Warning(401): Maybe you forgot
>>> to instantiate 'std::pair<int,int >' using %template.
>>>
>>> The actual declaration is:
>>> #include <utility>
>>> struct IntCoordinate : std::pair<int , int>
>>>
>>> The .i file also includes std_pair.i.  I don't have this problem
>>> with the std::vectors in the file.  Any ideas?  Thanks!
>>>
>>
>
> Thank you, Marcelo.  I was sure I tried this earlier with the same
> error, but it works now.  *shakes his head in confusion*  Why is it
> that I do not have to do this with my std::vectors as well?
>
probably you are not deriving a class from std::vector, as you are doing
with std::pair.

Anyway, if you don't do it for vectors, swig will treat them as opaque
types, so better do also

%template() std::vector<int>;

or

%template(vector_i) std::vector<int>;

Marcelo



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user