robotology / osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
https://robotology.github.io/osqp-eigen/
BSD 3-Clause "New" or "Revised" License
381 stars 112 forks source link

Assert statement in SparseMatrixHelper.tpp #141

Closed ghost closed 1 year ago

ghost commented 1 year ago

I was able to solve this problem with a little bit of research, but I was wondering if it was possible to include the library in SparseMAtrixHelper.tpp. It seems that the way assert statements are handled in g++ 12.2.0 and up are a bit different in that you have to include the assert.h library directly. So instead of:

#include <OsqpEigen/Debug.hpp>
.
.
.
    assert(innerOsqpPosition == numberOfNonZeroCoeff); //Will throw an error

you must do:

#include <OsqpEigen/Debug.hpp>
#include <cassert>
.
.
.
    assert(innerOsqpPosition == numberOfNonZeroCoeff); //Will compile

This is something I noticed after compiling osqp-eigen recently and getting this error:

 error: there are no arguments to ‘assert’ that depend on a template parameter, so a declaration of ‘assert’ must be available [-fpermissive]
   55 |     assert(innerOsqpPosition == numberOfNonZeroCoeff);

and then fixing it after a bit of quick research. I just wanted to bring attention to this so that any future work goes smoothly for anyone else that wants to use this project. Thank you.

traversaro commented 1 year ago

Thanks for reporting this problem! It should be fixed once https://github.com/robotology/osqp-eigen/pull/143 is merged.

GiulioRomualdi commented 1 year ago

Closing since https://github.com/robotology/osqp-eigen/pull/130 got merged. Please feel free to open it again in case of issues