It seems newlib defines index() as a string manipulation function, which conflicts with the name "index" of a global variable in this example. Perhaps newlib's string.h should be edited to comment out "index" which is likely to conflict with Arduino sketches?