Compilation error: exit status 1 On my NANO line follower

Here is my line following code. Please Help!

"Compilation error: exit status 1" I am very frustrated that I can't get past this error, I just don't know what it is or how to solve it.
.
First is the output of the serial monitor.


/var/folders/dh/cjqhp9_121z62n0mj153xm1h0000gq/T//ccovJ7QL.ltrans0.ltrans.o: In function main': /Users/tedmahler/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/main.cpp:46: undefined reference to loop'
collect2: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

Here is my code. It has worked in my robot without N.

// Line following code to operate L/R continuous rotation servos and L/R line sensors. Added platform tilt 7/20/2024 Thursnesday (Latest)
// Less than 90 on left is CW on left continuous rotation servo motor.
// greater than 90 on right is CCW on right continuous rotation servo motor.
// 90 is stop on both motors. Adjust trim screw on servo for no motion at stop.
//
// Prototype Function Declearations for compiler. Full decleartions later.
void Straight();
void Left();
void Right();
void No_movement();
//
#include <Servo.h>;
Servo LeftWheel;
Servo RightWheel;
Servo Platform;
bool Leftdetect = true;
bool Rightdetect = true;
int N = 0;
// ************************* SETUP *****************************
void setup(){;
pinMode(LED_BUILTIN, OUTPUT); // LED indicates when payload servo is active.
// int Platform.attach(11);
pinMode(9, OUTPUT); // Left Wheel
pinMode(10, OUTPUT); // Right wheel
pinMode(11, OUTPUT); // Platform tilt
// Sensors
pinMode(6, INPUT); // Left Line sensor
pinMode(7, INPUT); // Right Line sensor
bool Leftdetect = true;
bool Rightdetect = true;
// "N" is a Marker so we don't call "no-motion" repeatedly without first
// calling a motion function. With that understading "initilize the
// motion/tilt platform" marker to 0 since we have never called it before.
int N = 0;
// ************************ LØOP **************************
void LOOP ();
//
// LOOP to read sensors and call appropriate movement functions.
//
LeftWheel.attach(9);
RightWheel.attach(10);
//
// Read the Sensors.
Leftdetect = digitalRead(6);
Rightdetect = digitalRead(7);
//
// 1st test, call Straight if Line not seen in either left or right sensor
if ((Leftdetect == false) && (Rightdetect == false)) {;
// We are doing something other than stopping, Set Marker to 0.
N = 0;
Straight(); // Call straight Function
}; // Close 1st test: straight Line 49
//
// 2nd test. Line is seen only in left sensor. Remember False is the line.
if ((Leftdetect == false) && (Rightdetect == true)) {;
// (Tracking into line from left, Correct by turning left)
Left();
// We are doing something other than stopping, reset marker.
N = 0;
}; // Close 2nd Test. Left Turn.
//
// 3rd test. Line is seen only in Right sensor. Remember False is the line.
if ((Leftdetect == true) && (Rightdetect == false)) {;
// (Tracking into line from right, Correct by turning right)
Right();
// We are doing something other than stopping, reset marker.
N = 0;
}; // Close 3rd test. Right Turn. Line 64
//
// 4th test, No motion. Line sensed in both sensors, call Stop motion with Platorm tilt
//
if ((Leftdetect == true) && (Rightdetect == true)) {;
// Only proceed with No-movement/ Tilt Platform if marker has been reset
// to 0 saying we are coming from a movement function call.
if (N = 0) ;
// Proceed with No Movement function call and set the marker!
No_movement();
N = 1;
//
}; // Close 4th test. No Movement/platform tilt. Line 72
}; // End Of loop function. Line 36
//************************ FUNCTION DEFINITIONS ************************
// Movement Functions: Left side 90 counting up. Right side 90 counting down
void Straight (){;
LeftWheel.write(95); delay(50);
RightWheel.write(85);delay(50);
// Left - Stop position plus movement (90 + 5)
// Right - Stop position minus movement (90 - 5)
}; // Close straight function definition Line 85
//
void Left(){;
LeftWheel.write(90);delay(50);
RightWheel.write(85);delay(50);
// Left servo. No movement just Stop position (90)
// Right servo. Stop position minus movement (90 - 5)
}; // Close Left function definition Line 92
//
void Right(){;
LeftWheel.write(95);delay(50);
RightWheel.write(90);delay(50);
// Left servo. Stop position plus movement (90 + 5)
// Right servo No movement just Stop position (90)
}; // Close Right function definition Line 99
void No_movement(){;
LeftWheel.write(90);delay(500);
RightWheel.write(90);delay(500);
// Left servo. Stop position (90)
// Right servo. Stop position (90)
// Tilt platform by activating the platform tilt servo
// Turn builtin LED on while platform is active.
// Platform.write(90);
digitalWrite(LED_BUILTIN, HIGH);
delay(5000);
// Lower the platform by again activating platform tilt servo
// Platform.write(0);
// delay(100);
// Turn builtin LED off after platform is lowered
digitalWrite(LED_BUILTIN, LOW);
}; // Close No_movement

And here is your sketch properly enclosed with the <CODE/> tag, and formatted as well.

Please point out where the loop function is contained within it.

// Line following code to operate L/R continuous rotation servos and L/R line sensors. Added platform tilt 7/20/2024 Thursnesday (Latest)
// Less than 90 on left is CW on left continuous rotation servo motor.
// greater than 90 on right is CCW on right continuous rotation servo motor.
// 90 is stop on both motors. Adjust trim screw on servo for no motion at stop.
//
// Prototype Function Declearations for compiler. Full decleartions later.
void Straight();
void Left();
void Right();
void No_movement();
//
#include <Servo.h>;
Servo LeftWheel;
Servo RightWheel;
Servo Platform;
bool Leftdetect = true;
bool Rightdetect = true;
int N = 0;
// ************************* SETUP *****************************
void setup() {
   ;
   pinMode(LED_BUILTIN, OUTPUT);  // LED indicates when payload servo is active.
   // int Platform.attach(11);
   pinMode(9, OUTPUT);   // Left Wheel
   pinMode(10, OUTPUT);  // Right wheel
   pinMode(11, OUTPUT);  // Platform tilt
   // Sensors
   pinMode(6, INPUT);  // Left Line sensor
   pinMode(7, INPUT);  // Right Line sensor
   bool Leftdetect = true;
   bool Rightdetect = true;
   // "N" is a Marker so we don't call "no-motion" repeatedly without first
   // calling a motion function. With that understading "initilize the
   // motion/tilt platform" marker to 0 since we have never called it before.
   int N = 0;
   // ************************ LØOP **************************
   void LOOP();
   //
   // LOOP to read sensors and call appropriate movement functions.
   //
   LeftWheel.attach(9);
   RightWheel.attach(10);
   //
   // Read the Sensors.
   Leftdetect = digitalRead(6);
   Rightdetect = digitalRead(7);
   //
   // 1st test, call Straight if Line not seen in either left or right sensor
   if( (Leftdetect == false) && (Rightdetect == false) ) {
      ;
      // We are doing something other than stopping, Set Marker to 0.
      N = 0;
      Straight();  // Call straight Function
   };              // Close 1st test: straight Line 49
   //
   // 2nd test. Line is seen only in left sensor. Remember False is the line.
   if( (Leftdetect == false) && (Rightdetect == true) ) {
      ;
      // (Tracking into line from left, Correct by turning left)
      Left();
      // We are doing something other than stopping, reset marker.
      N = 0;
   };  // Close 2nd Test. Left Turn.
   //
   // 3rd test. Line is seen only in Right sensor. Remember False is the line.
   if( (Leftdetect == true) && (Rightdetect == false) ) {
      ;
      // (Tracking into line from right, Correct by turning right)
      Right();
      // We are doing something other than stopping, reset marker.
      N = 0;
   };  // Close 3rd test. Right Turn. Line 64
   //
   // 4th test, No motion. Line sensed in both sensors, call Stop motion with Platorm tilt
   //
   if( (Leftdetect == true) && (Rightdetect == true) ) {
      ;
      // Only proceed with No-movement/ Tilt Platform if marker has been reset
      // to 0 saying we are coming from a movement function call.
      if( N = 0 )
         ;
      // Proceed with No Movement function call and set the marker!
      No_movement();
      N = 1;
      //
   };  // Close 4th test. No Movement/platform tilt. Line 72
};     // End Of loop function. Line 36
//************************ FUNCTION DEFINITIONS ************************
// Movement Functions: Left side 90 counting up. Right side 90 counting down
void Straight() {
   ;
   LeftWheel.write(95);
   delay(50);
   RightWheel.write(85);
   delay(50);
   // Left - Stop position plus movement (90 + 5)
   // Right - Stop position minus movement (90 - 5)
};  // Close straight function definition Line 85
//
void Left() {
   ;
   LeftWheel.write(90);
   delay(50);
   RightWheel.write(85);
   delay(50);
   // Left servo. No movement just Stop position (90)
   // Right servo. Stop position minus movement (90 - 5)
};  // Close Left function definition Line 92
//
void Right() {
   ;
   LeftWheel.write(95);
   delay(50);
   RightWheel.write(90);
   delay(50);
   // Left servo. Stop position plus movement (90 + 5)
   // Right servo No movement just Stop position (90)
};  // Close Right function definition Line 99
void No_movement() {
   ;
   LeftWheel.write(90);
   delay(500);
   RightWheel.write(90);
   delay(500);
   // Left servo. Stop position (90)
   // Right servo. Stop position (90)
   // Tilt platform by activating the platform tilt servo
   // Turn builtin LED on while platform is active.
   // Platform.write(90);
   digitalWrite(LED_BUILTIN, HIGH);
   delay(5000);
   // Lower the platform by again activating platform tilt servo
   // Platform.write(0);
   // delay(100);
   // Turn builtin LED off after platform is lowered
   digitalWrite(LED_BUILTIN, LOW);
};  // Close No_movement

You need to show all the output, the error is generally at the start, not the end.

@tedster42
Please edit your post, select all code and click the <CODE/> button; next save your post. This will apply code tags around your code which makes the code easier to read and copy (as @van_der_decken demonstrates) and the forum software will display it correctly.

@sonofcy, this is a linker error and they are at the end :smiley:

1 Like