Unhandled exception at 0x6FEB1F62 (libstdc++-6.dll) in Octave Stand-alone program

0

I've created an Octave Stand-alone program that crashes after successfully running with the following error:

Unhandled exception at 0x6FEB1F62 (libstdc++-6.dll) in PDetection.exe: 0xC0000005: Access violation reading location 0x00000007.

Here is my code:

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/builtin-defun-decls.h>

int
main(void)
{
    string_vector argv(2);
    argv(0) = "PDetection";
    argv(1) = "-q";

    // 1. Initialize Octave interpreter
    octave_main(2, argv.c_str_vec(), 1);

    // 2. Read frame data from CSV into matrix
    Matrix a_matrix = Matrix(118, 48);
    std::ifstream file("framedata2.csv");

    for (int row = 0; row < 118; ++row)
    {
        std::string line;
        std::getline(file, line);
        if (!file.good())
            break;

        std::stringstream iss(line);

        for (int col = 0; col < 48; ++col)
        {
            std::string val;
            std::getline(iss, val, ',');
            if (!iss.good())
                break;

            std::stringstream convertor(val);
            convertor >> a_matrix(row, col);
        }
    }

    //// Print the matrix
    //std::cout << "Frame data:" << std::endl
    //<< a_matrix << std::endl;

    // 3. Pass frame data into Octave Algorithm
    octave_value_list in;
    in(0) = a_matrix;

    octave_value_list out = feval("pDetection", in, 1);
    double posture = out(0).double_value();

    // 4. Print out prediction
    if (!error_state && out.length() > 0)
    {

        std::cout << "Prediction:" << std::endl
            << posture << std::endl;
    }
    else
    {
        std::cout << "invalid\n";
    }

    return 0;
}

I'm brand new to C++, can anyone point me to a resource/help me figure out this bug? Thanks,

Melissa

c++
octave
asked on Stack Overflow Jul 7, 2015 by Melissa Jones

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0