Number / type issue of arguments being passed to overloaded C ++ constructor wrapped in swig
I'm trying to wrap a C ++ class (call it "Spam") written by someone else with swig to expose it to Python. After solving a few problems, I can import the module in python, but when I try to create an object of such a class, I get the following error:
foo = Spam.Spam('abc',3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Spam.py", line 96, in __init__
this = _Spam.new_Spam(*args)
NotImplementedError: Wrong number of arguments for overloaded function 'new_Spam'.
Possible C/C++ prototypes are:
Spam(unsigned char *,unsigned long,bool,unsigned int,SSTree::io_action,char const *)
Spam(unsigned char *,unsigned long,bool,unsigned int,SSTree::io_action)
Spam(unsigned char *,unsigned long,bool,unsigned int)
Spam(unsigned char *,unsigned long,bool)
Spam(unsigned char *,unsigned long)
By following the link, I realized that the error is probably caused by the type of the arguments, not the number (which is quite confusing), but I still can't figure out. I suspect the problem is with passing the string as the first argument, but have no idea how to fix it (remember that I hardly know c / C ++).
+2
a source to share
3 answers
This can be solved by changing the lines from 100 to 110
self.source = uhd_receiver(options.args, symbol_rate,
options.samples_per_symbol,
options.rx_freq, options.rx_gain,
options.spec, options.antenna,
options.verbose)
self.sink = uhd_transmitter(options.args, symbol_rate,
options.samples_per_symbol,
options.tx_freq, options.tx_gain,
options.spec, options.antenna,
options.verbose)
the next
self.source = uhd_receiver(options.args, symbol_rate,
options.samples_per_symbol, options.rx_freq,
options.lo_offset, options.rx_gain,
options.spec, options.antenna,
options.clock_source, options.verbose)
self.sink = uhd_transmitter(options.args, symbol_rate,
options.samples_per_symbol, options.tx_freq,
options.lo_offset, options.tx_gain,
options.spec, options.antenna,
options.clock_source, options.verbose)
Good luck.
-1
a source to share