[PyKDE] sip undefined type

jim jlh at yvn.com
Wed Feb 16 07:33:21 GMT 2005


Sirs:

I am trying to wrap the xbase c++ library so I can handle ca clipper xbase 
files from python.  (If anyone out there has a better suggestion I am all 
ears.)

When I try to run sip against my wrapper class I get an error similar to the 
following (different type, same error)

sip -c . pytest.sip
sip: std::string is undefined

This actual error is from running the following sip file, against the 
following c++ code.

I have written a small test class, a rather crude stack in c++ and was able to 
wrap it with sip.  When I added a string variable, it died with the above 
error.
**********************************************
pytest.sip

%Module pytest 0

class Stack
{

%TypeHeaderCode
#include "test4.h"
%End

public:
  std::string foo;
  Stack();
 
  void push(const int);
  int pop();

*************************************************

test4.h
#include <string>

class Stack
{
private:
  int count;
  int data[100];

public:
  std::string foo;
  Stack();
  
  void push(const int item);
  int pop();

};

***************************************************************

test4.cpp
#include "test4.h"

Stack::Stack()
{
  count = 0;
};


void Stack::push(const int item)
{
  data[count] = item;
  count++;

};

int Stack::pop()
{
  count--;
  return data[count];
};
*****************************************************************

This code compiles and links just fine in c++
I can create a lib file and call it from a c++ program.
If I remove the string foo; line, I can sip it and use it from python.

I am an excelent programmer in clipper, a passable programer in python and an 
amature in c++.

I would be more than glad to rtfm if I had a hint about which fm and where to 
look.  I have looked thru the last 6 months or so of the mailing list 
archives without any hints.

It would seem as if there is something I am missing somewhere, simple and 
obvious that I am looking past.

Thanks in advance,
Jim Hurlburt
Yakima, WA.




More information about the PyQt mailing list