2

I am trying compile he following in octave4.0 in Linux 14.04 :

mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims read_data.cpp

mex CFLAGS="\$CFLAGS -std=c99" -largeArrayDims write_data.cpp

The following error crops up :

****mkoctfile: unrecognized argument CFLAGS=-std=c99**

**warning: mkoctfile exited with failure status****

Anyone knows what this means and how to fix this?

user324
  • 331
  • 1
  • 5
  • 15

1 Answers1

1

You should run a setenv('CFLAGS','-std=c99 -whatever -else') command (inside octave) like, for instance:

setenv('CFLAGS','-std=c99');
mkoctfile --mex file.c

But perhaps you want to add the CFLAGS you already have. Well, I know no elegant way to do this, so I would do it manually with a

mkoctfile -p CFLAGS

And copy-paste the result together with your '-std-c99' option, or set it up in the shell before entering octave with a

~$ CFLAGS=$CFLAGS:"-std-c99" octave 

Source: http://octave.1599824.n4.nabble.com/mkoctfile-CFLAGS-not-recognised-td4281373.html

user27221
  • 334
  • 3
  • 16
  • I tried this, it doesn't work. Ive tried everything from the 'source' but it gives the same/similar error. – user324 Mar 30 '16 at 06:48
  • the command you posted on your question gives me this mistake as well, but using only `setenv('CFLAGS','-std=c99'); mkoctfile --mex file.c` worked for me with same version octave and ubuntu on the hello world example from octave: http://www.gnu.org/software/octave/doc/v4.0.1/Getting-Started-with-Mex_002dFiles.html#Getting-Started-with-Mex_002dFiles Can you post the error you get if you follow these exact steps? – user27221 Apr 04 '16 at 19:39