Not sure how to make interfacing with Eigen Sparse matrices

After reading a lot, I am still trying to write an interface for Eigen Sparse matrices with OSQP, but still no success, Code does fail when it calls exitflag = osqp_setup(&work, data, settings);. There is no error message as well. Any idea where could be the reason, for this. I spent more than two days );

header file

#include <osqp/osqp.h>
#include <Eigen/Sparse>

namespace osqp{
class OSQPInterface{
private:
    c_int   P_nnz;
    c_int   A_nnz;
    // Exitflag
    c_int exitflag = 0;

    // Workspace structures
    OSQPWorkspace *work;
    OSQPSettings  *settings;
    OSQPData      *data;

public:
    OSQPInterface();
    ~OSQPInterface();
    int updateMatrices(
        Eigen::SparseMatrix<double> & P_, 
        Eigen::SparseMatrix<double> & q_, 
        Eigen::SparseMatrix<double> & A_, 
        Eigen::SparseMatrix<double> & l_, 
        Eigen::SparseMatrix<double> & u_, 
        int warmStart = WARM_START
    );
    int update(Eigen::SparseMatrix<double>& l_, Eigen::SparseMatrix<double>& u_);
    int solveQP();
    int solveStatus();
    OSQPSolution* solPtr();
};
} // namespace osqp

Source file,

using namespace std;
using namespace Eigen;

namespace osqp{
OSQPInterface::OSQPInterface(){
    settings = (OSQPSettings *)c_malloc(sizeof(OSQPSettings));
    data     = (OSQPData *)c_malloc(sizeof(OSQPData));
}

OSQPInterface::~OSQPInterface(){
    delete settings;
    delete data;
    osqp_cleanup(work);
}

int OSQPInterface::updateMatrices(
    Eigen::SparseMatrix<double> & P_, 
    Eigen::SparseMatrix<double> & q_, 
    Eigen::SparseMatrix<double> & A_, 
    Eigen::SparseMatrix<double> & l_, 
    Eigen::SparseMatrix<double> & u_, 
    int warmStart
){
    // change Q_ upper triangular
    P_ = P_.triangularView<Upper>();
    // compress the matrices for osqp data
    q_.makeCompressed();
    A_.makeCompressed();
    l_.makeCompressed();
    u_.makeCompressed();

    data->n = P_.rows();
    data->m = A_.rows();
    // use the eigen sparse ptrs make it faster
    data->P = csc_matrix(data->n, data->n, P_.nonZeros(), 
        P_.valuePtr(), (c_int*)P_.innerIndexPtr(), (c_int*)P_.outerIndexPtr());
    data->q = new c_float[q_.rows()];
    for (int i=0; i<q_.rows(); ++i){
        data->q[i] = q_.coeffRef(i,0);
    }
    data->A = csc_matrix(data->m, data->n, A_.nonZeros(), 
        A_.valuePtr(), (c_int*)A_.innerIndexPtr(), (c_int*)A_.outerIndexPtr());
    data->l = new c_float[l_.rows()];
    for (int i=0; i<l_.rows(); ++i){
        data->l[i] = l_.coeffRef(i,0);
    }
    data->u = new c_float[u_.rows()];
    for (int i=0; i<u_.rows(); ++i){
        data->u[i] = u_.coeffRef(i,0);
    }
    if (settings) osqp_set_default_settings(settings);
    settings->warm_start = warmStart;
    exitflag = osqp_setup(&work, data, settings);
    delete data->q;
    delete data->l;
    delete data->u;
    return 0;
}

int OSQPInterface::update(Eigen::SparseMatrix<double>& l_, Eigen::SparseMatrix<double>& u_){
    c_float* updated_l = new c_float[l_.rows()];
    c_float* updated_u = new c_float[u_.rows()];
    for (int i=0; i<l_.rows(); ++i){
        updated_l[i] = l_.coeffRef(i,0);
        updated_u[i] = u_.coeffRef(i,0);
    }
    return osqp_update_bounds(work, updated_l, updated_u);
}

int OSQPInterface::solveQP(){
    // Solve Problem
    return osqp_solve(work);
}
int OSQPInterface::solveStatus(){
    return work->info->status_val;
}
OSQPSolution* OSQPInterface::solPtr(){
    return work->solution;
}
}// namespace osqp

Have you tried using the Eigen interface to OSQP available here: GitHub - robotology/osqp-eigen: Simple Eigen-C++ wrapper for OSQP library? I personally haven’t used eigen before, but I think that interface is maintained and should work.

Yeap, I saw that repo, but it does lots of intermediate things, which I don’t need