Error compiling for board Arduino/Genuino Uno.

Hi guys! I'm new to the Arduino. Right now I'm creating a sketch that will light up the led lights:

From left to right, one by one
From right to left, one by one
All odd numbered lights first, then all even numbered lights, run 5 times

After verifying the code, I'm getting this error messages which is:

Arduino: 1.8.1 (Windows 8.1), Board: "Arduino/Genuino Uno"

C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\Lab1Abuel.ino: In function 'void setup()':

C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\Lab1Abuel.ino:1:6: error: redefinition of 'void setup()'

void setup() {

^

C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\sketch_jan14a.ino:1:6: note: 'void setup()' previously defined here

void setup() {

^

C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\Lab1Abuel.ino: In function 'void loop()':

C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\Lab1Abuel.ino:16:6: error: redefinition of 'void loop()'

void loop() {

^

C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\sketch_jan14a.ino:16:6: note: 'void loop()' previously defined here

void loop() {

^

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Here's my code:

void setup() { 
  // put your setup code here, to run once: 
  pinMode(11, OUTPUT); 
  pinMode(12, OUTPUT); 
  pinMode(13, OUTPUT); 
  pinMode(14, OUTPUT); 
  pinMode(15, OUTPUT); 
  pinMode(16, OUTPUT); 
  pinMode(17, OUTPUT); 
  pinMode(18, OUTPUT); 
 
 
} 
 
 
void loop() { 
  digitalWrite(11, HIGH);   
  delay(1000);                      
  digitalWrite(11, LOW);    
  delay(1000);       
  digitalWrite(12, HIGH);   
  delay(1000);                      
  digitalWrite(12, LOW);    
  delay(1000);    
  digitalWrite(13, HIGH);    
  delay(1000);                   
  digitalWrite(13, LOW);   
  delay(1000);    
  digitalWrite(14, HIGH);  
  delay(1000);                        
  digitalWrite(14, LOW);    
  delay(1000);    
  digitalWrite(15, HIGH);    
  delay(1000);                       
  digitalWrite(15, LOW);    
  delay(1000);    
  digitalWrite(16, HIGH);   
  delay(1000);                       
  digitalWrite(16, LOW);    
  delay(1000);    
  digitalWrite(17, HIGH);    
  delay(1000);                       
  digitalWrite(17, LOW);   
  delay(1000);    
  digitalWrite(18, HIGH);   
  delay(1000);                      
  digitalWrite(18, LOW);     
  delay(1000);   
  digitalWrite(18, HIGH);    
  delay(1000);                       
  digitalWrite(18, LOW);   
  delay(1000);   
  digitalWrite(17, HIGH);   
  delay(1000);                     
  digitalWrite(17, LOW);    
  delay(1000);   
  digitalWrite(16, HIGH);  
  delay(1000);                    
  digitalWrite(16, LOW);   
  delay(1000);   
  digitalWrite(15, HIGH);  
  delay(1000);                     
  digitalWrite(15, LOW);    
  delay(1000);   
  digitalWrite(14, HIGH);  
  delay(1000);                   
  digitalWrite(14, LOW);    
  delay(1000);   
  digitalWrite(13, HIGH);    
  delay(1000);                    
  digitalWrite(13, LOW);    
  delay(1000);   
  digitalWrite(12, HIGH);   
  delay(1000);                      
  digitalWrite(12, LOW);   
  delay(1000);   
  digitalWrite(11, HIGH);    
  delay(1000);                       
  digitalWrite(11, LOW);   
  delay(1000);  
 
 
  for(int i = 1; i < 6; i++) 
  { 
    digitalWrite(11,HIGH); 
    digitalWrite(13,HIGH); 
    digitalWrite(15,HIGH); 
    digitalWrite(17,HIGH); 
    delay(1000); 
    digitalWrite(11,LOW); 
    digitalWrite(13,LOW); 
    digitalWrite(15,LOW); 
    digitalWrite(17,LOW); 
    digitalWrite(12,HIGH); 
    digitalWrite(14,HIGH); 
    digitalWrite(16,HIGH); 
    digitalWrite(18,HIGH); 
    delay(1000); 
    digitalWrite(12,LOW); 
    digitalWrite(14,LOW); 
    digitalWrite(16,LOW); 
    digitalWrite(18,LOW); 
  } 
}

If you look at the Arduino IDE window just below the Verify, Upload, New, Open, Save buttons and above the editor area you will see two tabs. One is named sketch_jan14a and the other is named Lab1Abuel. You can click on each tab to see the code in it. Tabs are useful to break a project into multiple parts so that you can navigate a lot of code quickly but at the stage you're at now you might be better off only using a single tab. You only posted the code from one of those tabs but they both have definitions of the setup() and loop() functions. This is not allowed. You can only have one definition of each function across all tabs of a sketch. So you need to remove one of the two definitions of each function.

Oh I see it now, I don't need the other .ino file I didn't know that they are in the same folder. I'm really sorry I'm new to the Arduino interface. Thank you for the help!

Yes, tabs are actually just the way the Arduino IDE displays different files in the sketch folder. All the .ino files are concatenated together into a single file before compiling so there's no functional difference between having your code broken into multiple tabs or all in one, it's just nice to break up large projects so you don't have to spend forever scrolling through thousands of lines of code. Glad I was able to help. Enjoy!

Thank you so much!

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

avr-gcc: error: CreateProcess: No such file or directory

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

this is the error im getting pls help me with this m new to ide pls guys my code is

#include <AFMotor.h>
#include <Servo.h>
#include <NewPing.h>

// defining which pins our sensor is connected to. If you want to select different pins, change the A4 and A5 to whichever pins you have used.
#define TRIG_PIN A4
#define ECHO_PIN A5
//Sets our max distance.
#define MAX_DISTANCE_POSSIBLE 1000
//Setting the max speed of motors.
#define MAX_SPEED 150 //
#define MOTORS_CALIBRATION_OFFSET 3
//Our collision distance.
#define COLL_DIST 20
#define TURN_DIST COLL_DIST+10
//Ping for the HC-SR04.
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE_POSSIBLE);
//declaring our motors. If you have connected your motors on the motor shield to slot M1 and M2, just change the 4 and 3, to whichever slots you have used.
AF_DCMotor leftMotor(4, MOTOR12_8KHZ);
AF_DCMotor rightMotor(3, MOTOR12_8KHZ);
//Our servo.
Servo neckControllerServoMotor;
//creating different variables.
int pos = 0;
int maxDist = 0;
int maxAngle = 0;
int maxRight = 0;
int maxLeft = 0;
int maxFront = 0;
int course = 0;
int curDist = 0;
String motorSet = "";
int speedSet = 0;

//will run once upon initialization.
void setup() {
//Attaching our servo to digital pin 9, via the motor shield. Write(90) sets servo to face forward.
neckControllerServoMotor.attach(9);
neckControllerServoMotor.write(90);
delay(2000);
checkPath();
motorSet = "FORWARD";
neckControllerServoMotor.write(90);
moveForward();
}

//run continuously.
void loop() {
checkForward();
checkPath();
}

void checkPath() {
int curLeft = 0;
int curFront = 0;
int curRight = 0;
int curDist = 0;
//sweeps to one side.
neckControllerServoMotor.write(144);
delay(120);
//range the servo can move through.
for(pos = 144; pos >= 36; pos-=18)
{
//turns servo through steps.
neckControllerServoMotor.write(pos);
delay(90);
checkForward();
curDist = readPing();
if (curDist < COLL_DIST) {
checkCourse();
break;
}
if (curDist < TURN_DIST) {
changePath();
}
if (curDist > curDist) {maxAngle = pos;}
if (pos > 90 && curDist > curLeft) { curLeft = curDist;}
if (pos == 90 && curDist > curFront) {curFront = curDist;}
if (pos < 90 && curDist > curRight) {curRight = curDist;}
}
maxLeft = curLeft;
maxRight = curRight;
maxFront = curFront;
}

void setCourse() {
if (maxAngle < 90) {turnRight();}
if (maxAngle > 90) {turnLeft();}
maxLeft = 0;
maxRight = 0;
maxFront = 0;
}

void checkCourse() {
moveBackward();
delay(500);
moveStop();
setCourse();
}

void changePath() {
if (pos < 90) {lookLeft();}
if (pos > 90) {lookRight();}
}

//Our sensor reading in cm.
int readPing() {
delay(70);
unsigned int uS = sonar.ping();
int cm = uS/US_ROUNDTRIP_CM;
return cm;
}

void checkForward() { if (motorSet=="FORWARD") {leftMotor.run(FORWARD); rightMotor.run(FORWARD); } }

void checkBackward() { if (motorSet=="BACKWARD") {leftMotor.run(BACKWARD); rightMotor.run(BACKWARD); } }

void moveStop() {leftMotor.run(RELEASE); rightMotor.run(RELEASE);}

//our move forward function.
void moveForward() {
motorSet = "FORWARD";
leftMotor.run(FORWARD);
rightMotor.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2)
{
leftMotor.setSpeed(speedSet+MOTORS_CALIBRATION_OFFSET);
rightMotor.setSpeed(speedSet);
delay(5);
}
}
//our move backward function.
void moveBackward() {
motorSet = "BACKWARD";
leftMotor.run(BACKWARD);
rightMotor.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2)
{
leftMotor.setSpeed(speedSet+MOTORS_CALIBRATION_OFFSET);
rightMotor.setSpeed(speedSet);
delay(5);
}
}
//our turn right function.
void turnRight() {
motorSet = "RIGHT";
leftMotor.run(FORWARD);
rightMotor.run(BACKWARD);
delay(400);
motorSet = "FORWARD";
leftMotor.run(FORWARD);
rightMotor.run(FORWARD);
}
//our turn left function.
void turnLeft() {
motorSet = "LEFT";
leftMotor.run(BACKWARD);
rightMotor.run(FORWARD);
delay(400);
motorSet = "FORWARD";
leftMotor.run(FORWARD);
rightMotor.run(FORWARD);
}

void lookRight() {rightMotor.run(BACKWARD); delay(400); rightMotor.run(FORWARD);}
void lookLeft() {leftMotor.run(BACKWARD); delay(400); leftMotor.run(FORWARD);}

I got this same exit 1 status error for the uno rev because I had a Serial.print statement in my code with no serial monitor open.

remohn:
I got this same exit 1 status error for the uno rev because I had a Serial.print statement in my code with no serial monitor open.

Nope. That will not cause an error.

remohn:
I got this same exit 1 status error for the uno rev because I had a Serial.print statement in my code with no serial monitor open.

You can't have the Serial Monitor open when compiling. So, this statement is complete nonsense.

Arduino: 1.6.12 (Windows 7), Board: "Arduino/Genuino Uno"

C:\arduino-1.6.12\arduino-builder -dump-prefs -logger=machine -hardware C:\arduino-1.6.12\hardware -tools C:\arduino-1.6.12\tools-builder -tools C:\arduino-1.6.12\hardware\tools\avr -built-in-libraries C:\arduino-1.6.12\libraries -libraries C:\Users\wagih\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10612 -build-path C:\Users\wagih\AppData\Local\Temp\arduino_build_285871 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\arduino-1.6.12\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\arduino-1.6.12\hardware\tools\avr -verbose C:\Users\wagih\AppData\Local\Temp\arduino_modified_sketch_205682\sketch_sep02a.ino
C:\arduino-1.6.12\arduino-builder -compile -logger=machine -hardware C:\arduino-1.6.12\hardware -tools C:\arduino-1.6.12\tools-builder -tools C:\arduino-1.6.12\hardware\tools\avr -built-in-libraries C:\arduino-1.6.12\libraries -libraries C:\Users\wagih\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10612 -build-path C:\Users\wagih\AppData\Local\Temp\arduino_build_285871 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\arduino-1.6.12\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\arduino-1.6.12\hardware\tools\avr -verbose C:\Users\wagih\AppData\Local\Temp\arduino_modified_sketch_205682\sketch_sep02a.ino
Using board 'uno' from platform in folder: C:\arduino-1.6.12\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\arduino-1.6.12\hardware\arduino\avr
Detecting libraries used...
"C:\arduino-1.6.12\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\arduino-1.6.12\hardware\arduino\avr\cores\arduino" "-IC:\arduino-1.6.12\hardware\arduino\avr\variants\standard" "C:\Users\wagih\AppData\Local\Temp\arduino_build_285871\sketch\sketch_sep02a.ino.cpp" -o "nul"
"C:\arduino-1.6.12\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\arduino-1.6.12\hardware\arduino\avr\cores\arduino" "-IC:\arduino-1.6.12\hardware\arduino\avr\variants\standard" "C:\Users\wagih\AppData\Local\Temp\arduino_build_285871\sketch\sketch_sep02a.ino.cpp" -o "C:\Users\wagih\AppData\Local\Temp\arduino_build_285871\preproc\ctags_target_for_gcc_minus_e.cpp"
C:\Users\wagih\AppData\Local\Temp\arduino_modified_sketch_205682\sketch_sep02a.ino:43:20: fatal error: I2Cdev.h: No such file or directory

#include "I2Cdev.h"

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

So you either did not install the I2Cdev library or you installed it incorrectly.

@wagihr
Upgrade from 1.6.12. All releases of the IDE between 1.6.5 and 1.8.1 were riddled with curious bugs.