Errors compiling a C++ class that includes Octave
Kyusik Chung
kyusik at gmail.com
Tue Jul 22 18:58:52 CDT 2008
Hi Riza,
I initially did that, but I don't believe you get the header files to
be able to compile your own C++ code that includes Octave libraries.
I was not able to find an "octave-dev" package to install via apt-get
install.
Kyusik
On Jul 23, 2008, at 7:53 AM, Abdul Rahman Riza wrote:
> Dear Kyusik,
>
> If you’re using Ubuntu Hardy Heron I suggest you one of two
> alternative way installing octave:
>
> Try this command in terminal => sudo apt-get install octave
> From synaptic manager select octave package and apply for
> installation then you can run it.
>
> Happy hacking,
> Riza
>
> From: Kyusik Chung [mailto:kyusik at gmail.com]
> Sent: Tuesday, July 22, 2008 3:56 PM
> To: help-octave at octave.org
> Subject: Errors compiling a C++ class that includes Octave
>
> Hello,
>
> I am new to both C++ and Octave, so apologies if my mistakes are
> obvious. I downloaded and installed Octave 3.0.1 on ubuntu 8.0.4.
>
> I have tried to compile a simple class that includes octave/
> Matrix.h. All I do right now is try to create a matrix using the
> following in my C++ code:
> Matrix m = Matrix(10, 10);
>
> (I looked at http://www.gnu.org/software/octave/doc/interpreter/Standalone-Programs.html#Standalone-Programs
> for an example)
>
> When I try to make, I get a long list of errors (partial pasted
> below). What am I doing wrong?
>
> Thanks!
>
> Kyusik
>
> ==============================
> g++ -c -o OctavePackage.o -O3 -Wall -I /usr/local/include/
> octave-3.0.1 -g OctavePackage.cpp
> In file included from /usr/local/include/octave-3.0.1/octave/dim-
> vector.h:31,
> from /usr/local/include/octave-3.0.1/octave/Array.h:
> 33,
> from /usr/local/include/octave-3.0.1/octave/Array2.h:
> 32,
> from /usr/local/include/octave-3.0.1/octave/
> boolMatrix.h:27,
> from /usr/local/include/octave-3.0.1/octave/mx-
> base.h:33,
> from /usr/local/include/octave-3.0.1/octave/Matrix.h:
> 31,
> from OctavePackage.cpp:6:
> /usr/local/include/octave-3.0.1/octave/oct-types.h:52:2: error:
> #error "No 2 byte integer type found!"
> /usr/local/include/octave-3.0.1/octave/oct-types.h:62:2: error:
> #error "No 4 byte integer type found!"
> In file included from /usr/local/include/octave-3.0.1/octave/mx-
> base.h:29,
> from /usr/local/include/octave-3.0.1/octave/Matrix.h:
> 31,
> from OctavePackage.cpp:6:
> /usr/local/include/octave-3.0.1/octave/MatrixType.h:34: error:
> function definition does not declare parameters
> In file included from /usr/local/include/octave-3.0.1/octave/dim-
> vector.h:30,
> from /usr/local/include/octave-3.0.1/octave/Array.h:
> 33,
> from /usr/local/include/octave-3.0.1/octave/Array2.h:
> 32,
> from /usr/local/include/octave-3.0.1/octave/
> boolMatrix.h:27,
> from /usr/local/include/octave-3.0.1/octave/mx-
> base.h:33,
> from /usr/local/include/octave-3.0.1/octave/Matrix.h:
> 31,
> from OctavePackage.cpp:6:
> /usr/local/include/octave-3.0.1/octave/lo-error.h:30: error:
> expected initializer before ‘GCC_ATTR_NORETURN’
> /usr/local/include/octave-3.0.1/octave/lo-error.h:44: error:
> expected constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/lo-error.h:46: error:
> expected constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/lo-error.h:48: error:
> expected constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/lo-error.h:50: error:
> expected constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/lo-error.h:52: error:
> expected constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/lo-error.h:54: error:
> expected constructor, destructor, or type conversion before ‘extern’
> In file included from /usr/local/include/octave-3.0.1/octave/Array.h:
> 33,
> from /usr/local/include/octave-3.0.1/octave/Array2.h:
> 32,
> from /usr/local/include/octave-3.0.1/octave/
> boolMatrix.h:27,
> from /usr/local/include/octave-3.0.1/octave/mx-
> base.h:33,
> from /usr/local/include/octave-3.0.1/octave/Matrix.h:
> 31,
> from OctavePackage.cpp:6:
> /usr/local/include/octave-3.0.1/octave/dim-vector.h: In member
> function ‘void dim_vector::resize(int, int)’:
> /usr/local/include/octave-3.0.1/octave/dim-vector.h:215: error:
> ‘current_liboctave_error_handler’ was not declared in this scope
> In file included from /usr/local/include/octave-3.0.1/octave/Array.h:
> 34,
> from /usr/local/include/octave-3.0.1/octave/Array2.h:
> 32,
> from /usr/local/include/octave-3.0.1/octave/
> boolMatrix.h:27,
> from /usr/local/include/octave-3.0.1/octave/mx-
> base.h:33,
> from /usr/local/include/octave-3.0.1/octave/Matrix.h:
> 31,
> from OctavePackage.cpp:6:
> /usr/local/include/octave-3.0.1/octave/lo-utils.h: At global scope:
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:36: error:
> expected initializer before ‘NINTbig’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:37: error: two or
> more data types in declaration of ‘NINT’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:38: error: two or
> more data types in declaration of ‘D_NINT’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:40: error: two or
> more data types in declaration of ‘strsave’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:42: error: two or
> more data types in declaration of ‘octave_putenv’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:44: error:
> expected initializer before ‘octave_fgets’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:45: error:
> expected initializer before ‘octave_fgetl’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:47: error:
> expected initializer before ‘octave_fgets’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:48: error:
> expected initializer before ‘octave_fgetl’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:50: error: two or
> more data types in declaration of ‘octave_gethostname’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:53: error: two or
> more data types in declaration of ‘octave_qsort’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:56: error: two or
> more data types in declaration of ‘oct_strptime’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:58: error:
> expected constructor, destructor, or type conversion before ‘int’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:60: error:
> expected constructor, destructor, or type conversion before ‘int’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:62: error: two or
> more data types in declaration of ‘octave_read_double’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:63: error:
> expected initializer before ‘octave_read_complex’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:65: error: two or
> more data types in declaration of ‘octave_write_double’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:66: error: two or
> more data types in declaration of ‘octave_write_complex’
> /usr/local/include/octave-3.0.1/octave/lo-utils.h:76: error:
> expected initializer before ‘octave_waitpid’
> In file included from /usr/local/include/octave-3.0.1/octave/
> boolMatrix.h:27,
> from /usr/local/include/octave-3.0.1/octave/mx-
> base.h:33,
> from /usr/local/include/octave-3.0.1/octave/Matrix.h:
> 31,
> from OctavePackage.cpp:6:
> /usr/local/include/octave-3.0.1/octave/Array2.h: In constructor
> ‘Array2<T>::Array2(const dim_vector&)’:
> /usr/local/include/octave-3.0.1/octave/Array2.h:62: error:
> ‘current_liboctave_error_handler’ was not declared in this scope
> /usr/local/include/octave-3.0.1/octave/Array2.h: In constructor
> ‘Array2<T>::Array2(const dim_vector&, const T&)’:
> /usr/local/include/octave-3.0.1/octave/Array2.h:68: error:
> ‘current_liboctave_error_handler’ was not declared in this scope
> In file included from /usr/local/include/octave-3.0.1/octave/mx-
> inlines.cc:29,
> from /usr/local/include/octave-3.0.1/octave/mx-op-
> defs.h:27,
> from /usr/local/include/octave-3.0.1/octave/
> boolMatrix.h:30,
> from /usr/local/include/octave-3.0.1/octave/mx-
> base.h:33,
> from /usr/local/include/octave-3.0.1/octave/Matrix.h:
> 31,
> from OctavePackage.cpp:6:
> /usr/local/include/octave-3.0.1/octave/quit.h: At global scope:
> /usr/local/include/octave-3.0.1/octave/quit.h:63: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:65: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:67: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:69: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:71: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:73: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:82: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:89: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:91: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:93: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:95: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:97: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:99: error: expected
> constructor, destructor, or type conversion before ‘extern’
> /usr/local/include/octave-3.0.1/octave/quit.h:189: error: expected
> initializer before ‘void’
> /usr/local/include/octave-3.0.1/octave/quit.h:190: error: expected
> initializer before ‘void’
> /usr/local/include/octave-3.0.1/octave/quit.h:191: error: expected
> initializer before ‘void’
>
> ... (a lot of other errors omitted for brevity)
>
>
> In file included from /usr/local/include/octave-3.0.1/octave/mx-
> ext.h:72,
> from /usr/local/include/octave-3.0.1/octave/Matrix.h:
> 33,
> from OctavePackage.cpp:6:
> /usr/local/include/octave-3.0.1/octave/CmplxQRP.h:33: error:
> function definition does not declare parameters
> OctavePackage.cpp: In member function ‘virtual void
> OctavePackage::Experiment1()’:
> OctavePackage.cpp:19: error: variable ‘Matrix m’ has initializer but
> incomplete type
> OctavePackage.cpp:19: error: invalid use of incomplete type ‘struct
> Matrix’
> /usr/local/include/octave-3.0.1/octave/MatrixType.h:27: error:
> forward declaration of ‘struct Matrix’
> OctavePackage.cpp:19: warning: unused variable ‘m’
> make: *** [OctavePackage.o] Error 1
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.5.4/1566 - Release Date:
> 7/22/2008 6:00 AM
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/help-octave/attachments/20080722/a8d0fdb7/attachment-0001.html
More information about the Help-octave
mailing list