C++ 犰狳/Xcode:“;仅在返回类型上不同的函数不能重载;无中生有

C++ 犰狳/Xcode:“;仅在返回类型上不同的函数不能重载;无中生有,c++,xcode,armadillo,C++,Xcode,Armadillo,首先,我知道以前在这个问题上有过问题,我的情况不同 我正在使用矩阵库进行Xcode中的一个研究项目。我已经深入到这个项目中了,到目前为止,我还没有遇到任何问题。然而,我最近做了一系列的更改,当我尝试重新编译项目时,尽管没有对Armadillo头源文件进行任何更改,但还是出现了以下错误 In file included from /Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/main.

首先,我知道以前在这个问题上有过问题,我的情况不同

我正在使用矩阵库进行Xcode中的一个研究项目。我已经深入到这个项目中了,到目前为止,我还没有遇到任何问题。然而,我最近做了一系列的更改,当我尝试重新编译项目时,尽管没有对Armadillo头源文件进行任何更改,但还是出现了以下错误

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_
^
包含在/Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/main.cpp:16的文件中:
文件包括/Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/TPS_RPM.h:19:
在/Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/T_-Params.h中包含的文件中:14:
在/usr/include/armadillo:121中包含的文件中:
/usr/include/armadillo_bits/lapack_bones.hpp:239:8:错误:仅返回类型不同的函数不能重载
void arma_fortran(arma_sgetrf)(blas_int*m、blas_int*n、float*a、blas_int*lda、blas_int*ipiv、blas_int*info);
^
在/Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/main.cpp:16中包含的文件中:
文件包括/Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/TPS_RPM.h:19:
在/Users/willandrew/Work/1-4th-Year/1Project/code/TPS-RPM(LAPACK)/TPS-RPM(LAPACK)/T_-Params.h中包含的文件中:14:
在/usr/include/armadillo:42中包含的文件中:
/usr/include/armadillo\u bits/compiler\u setup.hpp:36:34:注意:从宏“arma\u fortran”展开
#定义arma_fortran(函数)arma_fortran 2_noprefix(函数)
^
/usr/include/armadillo\u bits/compiler\u setup.hpp:25:44:注意:从宏“arma\u fortran2\u noprefix”展开
#定义arma_fortran2_noprefix(函数)函数##_
^
:203:1:注意:从此处展开
sgetrf_
^
错误列表(都是类似的)会一直持续到Xcode因为错误太多而停止编译为止。我在重新编译之前所做的更改包括添加一个新类和修改一些函数定义。然而,不幸的是,我无法撤消对每个文件所做的更改以查找错误,因为我必须重新启动计算机。我已经调查了这个错误,我确信我没有定义其他具有相同名称和不同返回类型的方法


这个问题有点长。。。但是否有人对错误的含义和/或我可以尝试做什么有一点指示?如果您希望我添加任何源代码/其他错误,请告诉我,并提前感谢

最终解决了问题,尽管我不知道问题出在哪里


在对项目进行重大更改的过程中,我升级到了最新的Xcode。降级回5.0.2似乎解决了上述问题。小心Xcode 5.1,我也面临同样的问题。当我在我的*.mm、*.h、*.cpp、*.hpp文件中将“armadillo”头文件include放在所有其他include/imports的顶部时,问题就解决了

#include "armadillo"
#include <stdlib.h>
#包括“犰狳”
#包括

我相信这是您在XCode中启用版本控制的提示。我已经启用了VC…您可能在某个地方定义了一个错误,或者您正在创建一个名为
arma\u sgetrf
arma\u sgetrf
sgetrf
的新函数,这与现有函数冲突。我强烈建议使用svn或git之类的版本控制系统,这样以后就可以撤消类似的更改。或者,在对代码进行重大更改之前,请使用源代码备份文件夹。谢谢,我现在定期推送到github存储库。通过降级到Xcode 5.0.2解决了此问题