help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: oct intNDArray functions not working


From: Reza Housseini
Subject: Re: oct intNDArray functions not working
Date: Thu, 22 Dec 2011 12:52:45 +0100

Thank you a lot Michael, that solved the problem!


On Thu, Dec 22, 2011 at 12:23 PM, Michael Goffioul <address@hidden> wrote:
On Thu, Dec 22, 2011 at 9:32 AM, Reza Housseini <address@hidden> wrote:
> Hello,
>
> I'm using the C++ API of Octave to write some code. In using the intNDArray
> declaration some problems with the functions occurred. Here the example:
>
> #include <octave/oct.h>
> #include <octave/intNDArray.h>
>
> DEFUN_DLD(test_intNDArray, args, nargout, "")
> {
>     octave_value_list retval;
>
>     intNDArray<int> BR(dim_vector(3,1),0);
>     FloatNDArray BF(dim_vector(3,1),0);
>
>     BR(0,0) = 10;
>     BF(0,0) = 9.8;
>
>     retval(0) = BR.max(0);
>     retval(1) = BF.max(0);
>
>     return retval;
> }
>
> which gives me the following error:
>
> error: /media/extra/Master/Masterarbeit/Octave/dynamic/test_intNDArray.oct:
> failed to load:
> /media/extra/Master/Masterarbeit/Octave/dynamic/test_intNDArray.oct:
> undefined symbol: _ZNK10intNDArrayIiE3maxEi
>
> although it compiles without errors. The FloatNDArray performs the operation
> without error, so it can't be an linking issue.

Don't use the generic intNDArray<> template class, use one of the
specialization classes available, like int32NDArray. Your problem is
that the implementation of the "max" method is not in a header file.
So when the compiler instantiate the intNDArray<int> class, it's
missing that method. You don't have the problem with FloatNDArray, as
this is already a specialization and the "max" implementation is
exported by liboctave.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]