Armadillo / Xcode: "functions that differ only in their return type cannot be overloaded" error from nowhere

StackOverflow https://stackoverflow.com/questions/22376644

  •  14-06-2023
  •  | 
  •  

Question

Firstly, I know there have been questions with this issue before, my situation differs.

I'm using the Armadillo matrix library for a research project within Xcode. I'm quite far into the project and so far, I haven't had any issues. However, I recently made a series of changes, and when I tried recompiling the project, I got the following errors, despite not making any changes to the Armadillo header source files.

In file included from /Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/main.cpp:16:
In file included from /Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/TPS_RPM.h:19:
In file included from /Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/T_Params.h:14:
In file included from /usr/include/armadillo:121:
/usr/include/armadillo_bits/lapack_bones.hpp:239:8: error: functions that differ only in their return type cannot be overloaded
  void arma_fortran(arma_sgetrf)(blas_int* m, blas_int* n,  float* a, blas_int* lda, blas_int* ipiv, blas_int* info);
       ^
In file included from /Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/main.cpp:16:
In file included from /Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/TPS_RPM.h:19:
In file included from /Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/T_Params.h:14:
In file included from /usr/include/armadillo:42:
/usr/include/armadillo_bits/compiler_setup.hpp:36:34: note: expanded from macro 'arma_fortran'
  #define arma_fortran(function) arma_fortran2_noprefix(function)
                                 ^
/usr/include/armadillo_bits/compiler_setup.hpp:25:44: note: expanded from macro 'arma_fortran2_noprefix'
  #define arma_fortran2_noprefix(function) function##_
                                           ^
<scratch space>:203:1: note: expanded from here
sgetrf_
^

The list of errors (which are all similar) continues until Xcode halts compilation because there are too many errors. The changes I made before recompiling consisted of adding a new class and modifying some function definitions. Unfortunately however, I can't undo the changes made on each file to find the error because I had to restart my computer. I've investigated the error and I'm certain I haven't defined other methods with the same name and different return type.

This question is a bit of a longshot... but does anyone have a slight indication as to what the error means and/or what I could try doing? Let me know if you want me to add any of the source code/additional errors and thanks in advance

Was it helpful?

Solution

I faced the same issue. It was resolved when I put "armadillo" header include on top of all other includes/imports in my *.mm, *.h, *.cpp, *.hpp files.

#include "armadillo"
#include <stdlib.h>

OTHER TIPS

Finally managed to fix the issue, although I have no idea what the problem was.

During the big changes I made to the project, I upgraded to the latest Xcode. Downgrading back to 5.0.2 seems to have fixed the problems above. Be wary of the Xcode 5.1

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top