cvxgrp / scs

Splitting Conic Solver
MIT License
553 stars 136 forks source link

error: use of undeclared identifier 'mean' #204

Closed ankane closed 2 years ago

ankane commented 2 years ago

Specifications

Description

Compilation fails with SCS 3.1.0 and USE_LAPACK=0 with error: use of undeclared identifier 'mean'. Changing line 88 to scs_float mean = 0.0; fixes it.

How to reproduce

make USE_LAPACK=0

Output

cc -g -Wall -Wwrite-strings -pedantic -funroll-loops -Wstrict-prototypes -I. -Iinclude -Ilinsys -O3 -fPIC  -DCTRLC=1  -DCOPYAMATRIX=1  -DGPU_TRANSPOSE_MAT=1  -DINDIRECT=1 -c src/scs.c -o src/scs_indir.o
cc -g -Wall -Wwrite-strings -pedantic -funroll-loops -Wstrict-prototypes -I. -Iinclude -Ilinsys -O3 -fPIC  -DCTRLC=1  -DCOPYAMATRIX=1  -DGPU_TRANSPOSE_MAT=1    -c -o src/util.o src/util.c
cc -g -Wall -Wwrite-strings -pedantic -funroll-loops -Wstrict-prototypes -I. -Iinclude -Ilinsys -O3 -fPIC  -DCTRLC=1  -DCOPYAMATRIX=1  -DGPU_TRANSPOSE_MAT=1    -c -o src/cones.o src/cones.c
cc -g -Wall -Wwrite-strings -pedantic -funroll-loops -Wstrict-prototypes -I. -Iinclude -Ilinsys -O3 -fPIC  -DCTRLC=1  -DCOPYAMATRIX=1  -DGPU_TRANSPOSE_MAT=1    -c -o src/aa.o src/aa.c
cc -g -Wall -Wwrite-strings -pedantic -funroll-loops -Wstrict-prototypes -I. -Iinclude -Ilinsys -O3 -fPIC  -DCTRLC=1  -DCOPYAMATRIX=1  -DGPU_TRANSPOSE_MAT=1    -c -o src/rw.o src/rw.c
cc -g -Wall -Wwrite-strings -pedantic -funroll-loops -Wstrict-prototypes -I. -Iinclude -Ilinsys -O3 -fPIC  -DCTRLC=1  -DCOPYAMATRIX=1  -DGPU_TRANSPOSE_MAT=1    -c -o src/linalg.o src/linalg.c
src/linalg.c:88:3: error: use of undeclared identifier 'mean'
  mean = 0.;
  ^
src/linalg.c:90:5: error: use of undeclared identifier 'mean'
    mean += x[i];
    ^
src/linalg.c:92:10: error: use of undeclared identifier 'mean'
  return mean / n;
         ^
3 errors generated.
make: *** [src/linalg.o] Error 1
bodono commented 2 years ago

Thanks, this is fixed in https://github.com/cvxgrp/scs/pull/205.

ankane commented 2 years ago

Great, thanks @bodono!