help-octave
[Top][All Lists]
Advanced

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

Re: invalid type conversion when using C++ API


From: Thomas D. Dean
Subject: Re: invalid type conversion when using C++ API
Date: Tue, 29 May 2018 12:39:53 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 05/27/18 15:45, lqj1990 wrote:
Hi all,

I'm new to Octave. I want to use some function in Octave using C++ API.
When I follow the tutorial
https://octave.org/doc/interpreter/Standalone-Programs.html (A.3), I
encounter an invalid type conversion problem.

The compiler shows that:
Severity        Code    Description     Project File    Line    Suppression 
State
Error   C2440   'static_cast': cannot convert from 'octave_idx_type *' to 'long
*'      TestOctaveStandAlone
c:\octave\octave-4.4.0\include\octave-4.4.0\octave\dim-vector.h 156     

The problem is located in oct-refcount.h, for the functions:
OCTAVE_ATOMIC_INCREMENT, OCTAVE_ATOMIC_DECREMENT,
OCTAVE_ATOMIC_POST_INCREMENT, OCTAVE_ATOMIC_POST_DECREMENT, in which a
variable x is converted from  octave_idx_type* to long*.

How can I resolve the problem?
I'm using VS2017, the compiler configuration is Debug, x64.
The Octave version is 4.4.0.

Thank you

This seems to work for me.  Octave 4.3.0+

> mkoctfile --link-stand-alone standalone.cc -o standalone
> ./standalone
Hello Octave world!
 11 12
 21 22

Tom Dean



reply via email to

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