Replace "fortran_vec" on const objects with "data". Casting away const is ok here. The pointers are only passed to functions that don't modify the data afaict. --- src/save_fits_image.cc.orig 2022-11-17 11:09:21.875653000 +0100 +++ src/save_fits_image.cc 2022-11-18 17:04:28.843175674 +0100 @@ -129,7 +129,7 @@ return octave_value_list(); } - double * datap = const_cast( image.fortran_vec() ); + double * datap = const_cast ( image.data () ); if( fits_write_img( fp, TDOUBLE, fpixel, len, datap , &status ) > 0 ) { fprintf( stderr, "Could not write image data.\n" ); --- src/save_fits_image_multi_ext.cc.orig 2022-11-17 11:09:21.875653000 +0100 +++ src/save_fits_image_multi_ext.cc 2022-11-18 17:21:18.905761447 +0100 @@ -137,7 +137,7 @@ fits_report_error( stderr, status ); return octave_value_list(); } - double * datap = const_cast( image.fortran_vec() ); + double * datap = const_cast ( image.data () ); if( fits_write_img( fp, TDOUBLE, fpixel, sz_axes[0]*sz_axes[1], datap + i*sz_axes[0]*sz_axes[1], &status ) > 0 ) { fprintf( stderr, "Could not write image data.\n" );