1

I'm trying to compile a developmental build, and I get this error during compilation:

unknown type name 'dgeqp3'

function cannot return function type 'void (int *, int *, double *, int *, int *, double *, double *, int *, int *)'

use of undeclared identifier 'dgeqp3'

The file that causes the error is arma_extra.C, which must be an add-on to Armadillo (C++ library for linear algebra & scientific computing). The first few lines (you better believe I get the same error messages for zqep3):

#include <cassert>
#include <sstream>
#include "arma_extra.h"
#ifdef DEVBUILD
#include <DEVBUILD.h>
#undef dgeqp3
#undef zgeqp3
#endif


/*!
 * Convert an integer to a string.
 */
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()

extern "C" {
void arma_fortran_noprefix(dgeqp3)(int*,int*,double*,int*,int*,double*,double*,int*,int*);
void arma_fortran_noprefix(zgeqp3)(int*,int*,std::complex<double>*,int*,int*,std::complex<double>*,std::complex<double>*,int*,double*,int*);
}

dgeqp3 is a LAPACK (Fortran 90 library for linear algebra) function, so it looks like Armadillo is trying to use some functions from LAPACK. I'm not familiar with a function declaration of the form

data_type my_function(what's this)(int,...);

I'm guessing it's a sort of wrapping, hence the external "C" to prevent function overloading?

But I've read elsewhere that this sort of syntax is forbidden, due to functions not being able to return functions. Indeed, this seems to be the second of the three error messages I get. I'm a bit desperate here so any help would be really appreciated.

Community
  • 1
  • 1
jezzo
  • 193
  • 10
  • 1
    Are you sure that `arma_fortran_noprefix` is actually defined beforehand? Looking through the Armadillo source code, there are internal macros named `arma_fortran_sans_prefix` and `arma_fortran_with_prefix`. – hbrerkere Mar 09 '20 at 01:41
  • @hbrerkere ahh that does it! Thank you for that catch, I was gearing up for something much more complicated. I'll accept as answer if you move it there. – jezzo Mar 09 '20 at 04:13
  • 1
    Be careful with using internal macros. The armadillo [documentation](http://arma.sourceforge.net/docs.html#api_additions) says not to use internal functionality: _"any function, class, constant or other code not explicitly described in the public API documentation is considered as part of the underlying internal implementation details, and may change or be removed without notice"_ – hbrerkere Mar 09 '20 at 04:30

0 Answers0