In a Unix/Linux/MacOS system, you would write mkoctfile mainprogram.cc square_function.o (assuming that you compiled square_function separately), or you could write mkoctfile mainprogram.cc square_function.cc
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; }_______________________________________________ Help-octave mailing list
|