Error message: expected ',' or '...' before '&' token

Hello! I am trying to update the firmware on my makergear M2 3D printer and I keep getting this error when I try and compile the file. I don't know much about coding at all and I haven't been able to solve the problem reading related posts. I have attached the entire folder that includes all the necessary h files.

Any ideas of what is wrong?

Thanks!

Marlin.zip (289 KB)

Any clue which line provoked the error? It is a syntax error in a function prototype or definition I think.

Yes it was the Marlin.ino file and the line of code that is getting the error is this:

FORCE_INLINE void print (const String &s)

for context here is the block of code that it is in:

FORCE_INLINE void print (const String &s)
    {
      for (int i = 0; i < (int)s.length(); i++) {
        write(s[i]);
      }
    }

Thanks!

I would re-download and open marlin, and copy all your settings into it. I bet while you were putting in info, you at some point accidently hit delte or backspace or A or any other random key. if you are new at this it might be easier than acutally finding the offending character.

or you can use a "diff" tool and compare it to the default version of the file. google it, a diff tool just compares two text files and tells you the differences. you will see all your edits, intentional or accidental! good luck!

I got it to compile by adding:

#include <Wire.h>

after:

#include <SPI.h>

in the main file (Marlin.ino).

However that is probably because of one of my internal libraries.

What version of the Arduino IDE do you have? What board do you have selected?

It looks to me like it might not have found the String type (for you).

I tried adding the line you suggested and I am still getting the same error. I am using 1.0.4 and I uploaded sanguino folders into the arduino hardware and have selected sanguino W ATmega644P

Did you also get this? (which I did when selecting Sanguino):

In file included from Marlin.h:26,
                 from cardreader.cpp:1:
pins.h:1118:2: error: #error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
In file included from cardreader.cpp:1:
Marlin.h:30:26: error: WProgram.h: No such file or directory

It helps to post all the error messages.

Yes, sorry I didn't notice the other errors before. Here are all the errors I got:

In file included from /Marlin.h:26,
                 from cardreader.cpp:1:
/pins.h:1118:2: error: #error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
In file included from cardreader.cpp:1:
/Marlin.h:30:26: error: WProgram.h: No such file or directory
In file included from /Marlin.h:38,
                 from cardreader.cpp:1:
MarlinSerial.h:116: error: expected ',' or '...' before '&' token
MarlinSerial.h:116: error: ISO C++ forbids declaration of 'String' with no type
MarlinSerial.h:135: error: expected ',' or '...' before '&' token
MarlinSerial.h:135: error: ISO C++ forbids declaration of 'String' with no type
/MarlinSerial.h: In member function 'void MarlinSerial::print(int)':
MarlinSerial.h:118: error: 's' was not declared in this scope
In file included from cardreader.cpp:1:
/Marlin.h: At global scope:
Marlin.h:106: error: variable or field 'manage_inactivity' declared void
Marlin.h:106: error: 'byte' was not declared in this scope
cardreader.cpp: In constructor 'CardReader::CardReader()':
cardreader.cpp:29: error: 'millis' was not declared in this scope
cardreader.cpp: In member function 'void CardReader::checkautostart(bool)':
cardreader.cpp:419: error: 'millis' was not declared in this scope

I just discovered I won't need to update the firmware, so I might not need to worry about the errors. Thank you for all of your help!