How to resolve warning related to deprecated armadillo function in C++

130 Views Asked by At

I am very new to C++, and I am using the C++ library (armadillo) for my UG project. I was using a computer on which armadillo was already installed. When I compiled the code, it was warning-free. Very recently, I updated the armadillo library with the recent release (and forgot to keep a backup), and now my compiler is showing the following warning

485 13 D:\LAB HDD\main.cpp  [Warning] 'arma::mat_injector<arma::Mat<eT> > arma::Mat<eT>::operator<<(eT) [with eT = double]' is deprecated [-Wdeprecated-declarations]

where the associated code is

if(temp1==2) {
    uvec q1 = find(arma::strans(atmp));
    q2<<M(q1(0))<<M(q1(1))<<endr; //there is warning
    EdgeU.insert_cols(n, arma::strans(q2));
    q3<<m<<k;//there is warning
    Triangle.insert_cols(n,arma::strans(q3));
    n=n+1;
}

Can anyone point out why it is showing a warning in two instances? Any reference where I can read about removing these warnings? Thank you.

I tried to go through the library, which mentioned the exception. However, I am not an expert; therefore probably, I am missing something.

I am expecting that the code will compile with minimal warnings, and this issue may affect future work.

Edit:

Following is the minimal code to reproduce the warning thrown by the compiler

 #include <iostream>
 #include <armadillo>

 using namespace std;
 using namespace arma;

 int main(){
  mat A;
  float B,C;

  B=1.098;
  C=23.0987;

  A << B << C<< endr; // This line throwing warning

  return 0;
 }

and the warning is

 14 8   C:\test\main.cpp    [Warning] 'arma::mat_injector<arma::Mat<eT> > arma::Mat<eT>::operator<<(eT) [with eT = double]' is deprecated [-Wdeprecated-declarations]
0

There are 0 best solutions below