[Top][All Lists]

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

Compiling old OCT files

From: John W. Eaton
Subject: Compiling old OCT files
Date: Thu, 9 Sep 2004 14:25:05 -0400

On  9-Sep-2004, E. Joshua Rigler <address@hidden> wrote:

| I recently decided to dust off some old DLD functions I developed a few
| years ago using Octave 2.1.34 (or so), and Redhat linux 7.2.  Now I use
| Octave 2.1.57 (self-compiled with Octave Forge) on Enterprise Redhat,
| and I get two consistent errors that didn't used to occur.
| 1) Every time I try to return a null matrix after printing out an error
| message (i.e.,
| [376]  error ("Too many inputs.\n");
| [377]  return retval = Matrix (0,0);
| ), I get this error when I use mkoctfile:
| no match for `octave_value_list& = Matrix' operator
| /usr/local/include/octave-2.1.57/octave/oct-obj.h:78: candidates are:
|    octave_value_list& octave_value_list::operator=(const octave_value_list&)

What is the type of retval?  I assume it must be octave_value_list.

  return octave_value (Matrix (0, 0));


| 2) I am having problems with strings.  Sadly, I don't really remember
| why I coded things the way I did three years ago.  I think I took some
| hints from JWE.  Everything worked, but I didn't really understand what
| I was doing at the time.  For instance, the following code used to work
| for copying a "const char*" value to a "char*" because the C library
| function I was writing a wrapper for couldn't handle the former:
| [488]  char *fmt = new char [args(1).string_value ().length () +1];
| [489]  args(1).string_value ().copy (fmt, string::npos);
| [490]  fmt [args(1).string_value ().length ()] = '\0';
| Now, I get the following error:
| `string' undeclared (first use this function)
| (Each undeclared identifier is reported only once for each
|      function it appears in.)
| syntax error before `::' token

How about

  std::string s = args(1).string_value ();
  size_t slen = s.length ();
  char *t = new char [slen+1];
  s.copy (t, std::string::npos);
  t[slen] = '\0';



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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