help-octave
[Top][All Lists]
Advanced

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

oct-file compiling problem


From: matthias . bergmeister
Subject: oct-file compiling problem
Date: Wed, 07 Jun 2006 15:03:49 +0200


Hello,

I use octave 2.1.73 under cygwin and I am currently developing my first first C++ oct-file. Now, I have a problem using mkoctfile.  I included an example below to illustrate my problem. When calling the function "square_double" contained in square_function, I do not no how to tell mkoctfile to compile square_function and link it to my main program. All three files reside in the same directory, which is c:\octave-files. When I call "mkoctfile mainprogram.cc" I get an error saying "undefined reference to 'square_double(double)' ". How do I use mkoctfile correctly?

Thanks in advance for your help
Matthias

mainprogram.cc
#include <octave/oct.h>
#include "square_function.h"

DEFUN_DLD (mainprogram, args, ,  "returns the squared input value")
{
 octave_value retval;
 double a = args(0).scalar_value();
 a = square_double(a);
 retval = octave_value(a);
 return retval;  
}



square_function.h
#ifndef _SQUARE_FUNCTION_H
#define _SQUARE_FUNCTION_H

double square_double (double val);

#endif

square_function.cc
#include "square_function.h"

double square_double (double val){
  val = val * val;
  return val;
}
reply via email to

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