I'm generating code for a function with several variable-sized arrays. The code needs to be compiled in both linux (with gcc) and windows machines (with MinGW).
To "ensure capacity" in those variables, Matlab creates several counter variables, named i349
, i350
, ..., i386
, ... i400
. Apparently, the windows compiler doesn't like this. It throws two errors that say :
line x: error: expected identifier or '(' before numeric constant
line y: error: lvalue required as left operand of assignment
line y+1: error: lvalue required as increment operand
These are all solved by manually picking other variable names. While I could use some script to automatically do so, I'd rather avoid it.
Two questions:
Why does these variable names cause a problem with the compiler?
How can I tell Matlab not to generate variables with these names?