我正在尝试为Android构建 CHOLMOD库(suitesparse的一部分)。该库使用基于Makefile的构建系统,我正在尝试使用CMake。
现在t_cholmod_triplet.c
是库的一部分,并通过以下方式定义函数:
#include "cholmod_template.h"
#include "cholmod_core.h"
#include "cholmod_internal.h"
static size_t TEMPLATE (cholmod_triplet_to_sparse)
(
/* ---- input ---- */
cholmod_triplet *T,/* matrix to copy */
/* ---- in/out --- */
cholmod_sparse *R,/* output matrix */
/* --------------- */
cholmod_common *Common
)
{
double *Rx,*Rz,*Tx,*Tz ;
Int *Wj,*Rp,*Ri,*Rnz,*Ti,*Tj ;
Int i,j,p,p1,p2,pdest,pj,k,stype,nrow,ncol,nz ;
size_t anz ;
...
... Computations
...
return (anz)
}
当我尝试构建时,clang抱怨以下内容:
error: function cannot return function type 'size_t (cholmod_triplet *,cholmod_sparse *,cholmod_common *)' (aka 'unsigned int (struct cholmod_triplet_struct *,struct cholmod_sparse_struct *,struct cholmod_common_struct *)')
从上述函数的最后一行开始,它返回类型size_t
。但是Clang认为它正在返回一个函数(错误描述)。这是什么原因呢?哪些最小的更改可以纠正此错误?
Edit-1
完成干净的项目并重建后,现在我遇到了t_cholmod_dense.c
link to file
错误足迹相似,返回类型被错误地识别:
error: function cannot return function type 'cholmod_dense *(cholmod_sparse *,cholmod_common *)' (aka 'struct cholmod_dense_struct *(struct cholmod_sparse_struct *,struct cholmod_common_struct *)')
Edit-2
#include "cholmod_core.h"
#include "cholmod_internal.h"
#include "cholmod_template.h"
static void TEMPLATE (change_simplicial_numeric)
(
cholmod_factor *L,Int to_ll,Int to_packed,Int *newLi,double *newLx,double *newLz,Int lnz,Int grow,double grow1,Int grow2,Int make_ll,Int make_monotonic,Int make_ldl,cholmod_common *Common
)
{
引发以下错误:
app/src/main/cpp/include/CHOLMOD/Core/t_cholmod_change_factor.c:23:22: error: function cannot return function type 'void (cholmod_factor *,int,int *,double *,double,cholmod_common *)' (aka 'void (struct cholmod_factor_struct *,struct cholmod_common_struct *)')