Go Down

Topic: Problem with redefinition of "void loop()" when compiling (Read 310 times) previous topic - next topic

projectguy23

Everytime i compile even a basic file for arduino 101 it shows a message for redefinition of void loop
this is the error i get

C:\Users\George\Desktop\Arduino\libraries\LiquidCrystal\examples\HelloWorld\HelloWorld.ino: In function 'void loop(...)':

HelloWorld:53: error: redefinition of 'void loop(...)'

 void loop() {

      ^

In file included from c:\users\george\appdata\local\arduino15\packages\intel\tools\arc-elf32\1.6.4+1.0\arc-elf32\sys-include\sys\config.h:5:0,

                 from c:\users\george\appdata\local\arduino15\packages\intel\tools\arc-elf32\1.6.4+1.0\arc-elf32\sys-include\_ansi.h:16,

                 from c:\users\george\appdata\local\arduino15\packages\intel\tools\arc-elf32\1.6.4+1.0\arc-elf32\sys-include\stdlib.h:11,

                 from C:\Users\George\AppData\Local\Arduino15\packages\Intel\hardware\arc32\1.0.5\cores\arduino/Arduino.h:24,

                 from C:\Users\George\AppData\Local\Temp\builded69793b6932109a9bdacbf180af5d05.tmp\sketch\HelloWorld.ino.cpp:1:

c:\users\george\appdata\local\arduino15\packages\intel\tools\arc-elf32\1.6.4+1.0\arc-elf32\sys-include\sys\features.h:210:6: error: 'void loop(...)' previously defined here

 void loop()

      ^

Using library LiquidCrystal at version 1.0.5 in folder: C:\Users\George\Desktop\Arduino\libraries\LiquidCrystal
exit status 1
redefinition of 'void loop(...)'

im not sure but it keep telling me that the void loop has already been defined in the features.h file
can anyone help with this problem??


here is the basic code im using...

/*
  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}

GoForSmoke

Put your code inside of [code]  [/code] tags.
Quote this post to see the ones below.

This "basic" code compiles for me. What are you trying to compile?
Code: [Select]

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

jaholmes

I've run into this problem a few times, and have found that closing/re-launching the IDE generally restores its sanity.  Have you tried that?  For me, the problem occurs semi-frequently in projects involving multiple source files--a bunch of additional headers in my sketch directory, for instance.  My guess is that one of the IDE's language tweaks, like auto-generation of function prototypes, occasionally runs off into the weeds and redefines things.  I'll dig deeper next time.  Maybe.

projectguy23

@goforsmoke im trying to combine 2 sets of code for use with the osepp lcd keypad and the osepp sensor shield. i wiped my system of old files and reloaded a fresh version of Arduino ide software and it seems to have worked. i will continue with it tomorrow to see if i encounter any more issues

GoForSmoke

If you don't show the code that gives the problem it makes it hard to give you a good answer.
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

projectguy23

@GoForSmoke i figured out the problem and have been successfully verified several files. the problem was with the features.h file in the main arduino program. thanks for your help

UKHeliBob

Well, the error message did tell you where the problem was...
Code: [Select]

c:\users\george\appdata\local\arduino15\packages\intel\tools\arc-elf32\1.6.4+1.0\arc-elf32\sys-include\sys\features.h:210:6: error: 'void loop(...)' previously defined here
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up