help-octave
[Top][All Lists]
Advanced

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

Re: How to write a c++ application using cygwin?


From: Stefan van der Walt
Subject: Re: How to write a c++ application using cygwin?
Date: Fri, 3 Feb 2006 12:16:34 +0200
User-agent: Mutt/1.5.9i

On Fri, Feb 03, 2006 at 09:13:29AM +0100, Hermann Schloss wrote:
> The question now is, how can I create an application (for example see below)
> using octave under cygwin?
>  
> #include <iostream>
> #inlcude <octave/config.h>
> #include <octave/Matrix>
>  
> using namespace std;
>  
> int main()
> {
>             Matrix m = (3,2);
>             // filling the matrix
>             Matrix n = m.inverse();
>             cout   << n;
>             return 0;
> }

You should modify your program to include Matrix.h instead.  Also, you
cannot invert a 3x2 matrix.  A matrix is initialised by doing

Matrix m = Matrix(3,2,0);

or

Matrix m(3,2,0);

(You can also do Matrix m(3,2); but then you need to make sure that you 
manually initialise *all* the values).

Your code can be compiled using something similar to

$ mkoctfile --link-stand-alone -v testoctave.cc -o testoctave

Regards
Stéfan

Attachment: testoctave.cc
Description: Text Data


reply via email to

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