How can I run an Octave (.m) file from C++ written in Qt?
Jeriel Jammullamudy <[email protected]> Wed, 3 Aug 2022 16:44:07 -0500
| Newsgroups | gmane.comp.gnu.octave.general |
|---|---|
| Message-ID | <CAGYX+PfgXsQC1YbQqh74Aeu_98_KJ2jV2kDWNhYO6D0=MYWTpQ@mail.gmail.com> |
My goal is to run an Octave file (an original .m script) from C++ written
in Qt.
Currently, I am using Octave v7.1.0 on Windows 10, and the C++17 code is
written in the Qt IDE v7.0.2. Additionally, my Build Environment has been
edited to include mkoctfile.exe for compiling purposes.
I have followed the descriptions found from the Octave user manual in
working with standalone programs, found here: Standalone Programs
<https://docs.octave.org/v7.1.0/Standalone-Programs.html>. I can get the
first matrix example problem working fine as shown with the following
designed output,
11:51:02: Starting
C:\Users\berg\Documents\build-ForgeOctave-Desktop_Qt_6_3_1_MinGW_64_bit-Debug\debug\ForgeOctave.exe...FTH:
(2596): *** Fault tolerant heap shim applied to current process. This
is usually due to previous crashes. ***
Hello Octave world!
11 12
21 2211:51:02:
C:\Users\berg\Documents\build-ForgeOctave-Desktop_Qt_6_3_1_MinGW_64_bit-Debug\debug\ForgeOctave.exe
exited with code 0
however the second example that requires the octave interpreter (which is
needed for calling external Octave .m files per Standalone Programs
<https://docs.octave.org/v7.1.0/Standalone-Programs.html>) crashes with the
following output:
11:54:52: Starting
C:\Users\berg\Documents\build-ForgeOctave-Desktop_Qt_6_3_1_MinGW_64_bit-Debug\debug\ForgeOctave.exe...FTH:
(11156): *** Fault tolerant heap shim applied to current process. This
is usually due to previous crashes. ***error: ignoring const
execution_exception& while preparing to exiterror: ignoring const
execution_exception& while preparing to exiterror encountered in
Octave evaluator!11:54:53:
C:\Users\berg\Documents\build-ForgeOctave-Desktop_Qt_6_3_1_MinGW_64_bit-Debug\debug\ForgeOctave.exe
exited with code 0
This leads me to believe that my issue is IDE-related. The exact issue
that I am having at the moment, is when I call the Octave interpreter
(octave::interpreter), it simply returns an error message of a crash.
My suspicion is that I may be missing a link to needed libraries or
need to further edit my Build Environment or Build Steps.
Below is my .pro file.
TEMPLATE = app
CONFIG += console c++17
CONFIG -= app_bundle
CONFIG += qt
LIBS+= -L C:\Users\berg\Desktop\Octave\octave-7.1.0-w64\mingw64\bin
-loctave-9 -LC:\Users\berg\Desktop\Octave\octave-7.1.0-w64\mingw64\lib\octave\7.1.0
-loctinterp -loctave
SOURCES += \
main.cpp
INCLUDEPATH += C:\Octave-7.1.0\mingw64\include\octave-7.1.0\octave
libmatrix.a
Does anyone have any idea how to solve this Octave interpreter problem or
have suggestions? Thanks!
----------
We are transitioning to a web based forum
for community help discussions at
https://octave.discourse.group/c/help