# Marlin error Rx_buffer not declared in scope

After one successful preview of compile, the upload returns error

rx_buffer not defined in this scope.


How do I fix this?

• Welcome to 3dPrinting.SE! Apr 19 '19 at 2:03
• Have you changed #define SERIAL_PORT 0 in MarlinSerial.h?
– 0scar
Apr 19 '19 at 14:22
• Have you found and fixed the problem? If so, has the answer below led you to the solution? Please vote to accept the answer so this question is not bumped up once in a while and can be removed from the unanswered question list. You may even add your own solution and accept that after 48 hours! If you have not been able to address the problem please update your question. May 7 '19 at 5:21

The line defining SERIAL_PORT in MarlinSerial.h should read:

#define SERIAL_PORT 0


To [mis-]quote this answer from RepRap:'rx_buffer' was not declared in this scope (the emphasis is mine):

#define SERIAL_PORT 4


This is the serial port on the controller, not the serial port on your computer. 0 through 3 are valid options on a controller with a atmel 2560.

Unless you are doing something like serial over bluetooth or deliberately not using the USB port you should not change this from 0

The same error is reported on the Arduino forums, 'rx_buffer' was not declared in this scope:

Have redone over 5 times and always getting " 'rx_buffer' was not declared in this scope ".

Now I tried Factory marlin and same " 'rx_buffer' was not declared in this scope " . Dont know what to do - I'm so lost.

...

#define SERIAL_PORT 4     //before was 0


Nothing else