Error compiling

Hi
I have just bought a arduino starter kit,when i upload the program this error message pop up

core.a(main.cpp.o): In function main': C:\Program Files\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to setup'
C:\Program Files\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop'
I absolute got no idea at all cos i am a new starter
anyone got any idea pls help..........
cheer

Which program did you compile?

Have you tried to compile an example program included in arduino? They are under file->examples.

You either tried to compile an empty sketch (unlikely) or you've written a program that misses the arduino entry points: setup() and loop().

See the examples included with the Arduino IDE. E.g. File => Examples => Basics => BareMinimum

It sounds like you could have possible used a 'int main()' vice 'void loop()' as your main program. Not sure without seeing what you are trying to compile, but that's my guess with the given information... Good luck!!

bushtuckerman:
Hi
I have just bought a arduino starter kit,when i upload the program this error message pop up

core.a(main.cpp.o): In function main': C:\Program Files\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to setup'
C:\Program Files\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop'
I absolute got no idea at all cos i am a new starter
anyone got any idea pls help..........
cheer

1)Post your code here using code tags.
2) Have you downloaded IDE or you just copied from other PC. because i got same error message when i just copied from one pc to other . later i downloaded the New IDE from net and then started working fine

TDMurphy:
It sounds like you could have possible used a 'int main()' vice 'void loop()' as your main program. Not sure without seeing what you are trying to compile, but that's my guess with the given information... Good luck!!

Don't necropost!

Hi, I want to transmit and receive a character trough a 433MHz RF and then make a servo go 1600 microseconds if the character is received. I came up with these two codes which i crafted from past codes that worked fine, but now i keep getting Error compiling. If u can please take a look at it I would be grateful. Thanks.

1st Code:

#include <VirtualWire.h>
#include <Servo.h>

Servo motor;

void setup()
{
motor.attach(3);

vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(2);
vw_setup(4000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running

Serial.begin(9600);
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking
{
if(buf[0]=='1') go();
}
}
void go()
{
Serial.println("1600");
motor.writeMicroseconds(1600);
}

and 2nd code:

#include <VirtualWire.h>
#include <Servo.h>

Servo motor;

void setup()
{
motor.attach(3);

vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(2);
vw_setup(4000); // Bits per second
vw_rx_start(); // Start the receiver PLL running

Serial.begin(9600);
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking
{

if(buf[0]=='F')
{
Serial.println("1600");
motor.writeMicroseconds(1600);
}
}
}

but now i keep getting Error compiling.

Specifically, what error(s)?

Why can't you be bothered to use code tags?

I had the same Problem with uploading or verifying code on to my board.

First tried to check and reinstall my Arduino Micro drivers. Unfortunately this didn't work.
Then I thought about that Windows 10 and the latest Arduino Version might be the Problem.

I installed an older Version from Error compiling - Programming Questions - Arduino Forum

1.6.7

This one didn't cause any issues and the Error was finaly gone!

i try to upload it to the arduino but i keep getting the

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

FindFirstFile C:\Users\taran\AppData\Local\Temp\arduino_cache_599769: The system cannot find the file specified.

Error compiling for board Arduino/Genuino Uno.
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\20180202_vu_meter_update: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\20180202_vu_meter_update
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Adafruit: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Adafruit
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\BlinkyBall-master: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\BlinkyBall-master
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Button_State: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Button_State
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\CH341SER: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\CH341SER
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Game_menu: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Game_menu
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\I2C_Scanner: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\I2C_Scanner
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\individual__pixel: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\individual__pixel
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\keypad_values: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\keypad_values
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\knocki: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\knocki
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\LEDMatrixSerial: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\LEDMatrixSerial
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\LED_Matrix: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\LED_Matrix
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\LEFT_RIGHT__CENTER: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\LEFT_RIGHT__CENTER
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\micropython-ws2812-master: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\micropython-ws2812-master
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\multiplesketches_master: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\multiplesketches_master
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Oscilliscope: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Oscilliscope
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\pattern_test: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\pattern_test
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\pixeltime: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\pixeltime
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Seafarers: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Seafarers
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\simple_lcd_menu: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\simple_lcd_menu
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\SmartMatrix3-3.0.1: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\SmartMatrix3-3.0.1
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Yahzee: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Yahzee
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\20180202_vu_meter_update: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\20180202_vu_meter_update
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Adafruit: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Adafruit
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\BlinkyBall-master: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\BlinkyBall-master
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Button_State: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Button_State
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\CH341SER: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\CH341SER
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Game_menu: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Game_menu
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\I2C_Scanner: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\I2C_Scanner
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\individual__pixel: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\individual__pixel
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\keypad_values: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\keypad_values
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\knocki: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\knocki
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\LEDMatrixSerial: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\LEDMatrixSerial
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\LED_Matrix: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\LED_Matrix
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\LEFT_RIGHT__CENTER: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\LEFT_RIGHT__CENTER
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\micropython-ws2812-master: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\micropython-ws2812-master
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\multiplesketches_master: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\multiplesketches_master
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Oscilliscope: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Oscilliscope
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\pattern_test: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\pattern_test
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\pixeltime: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\pixeltime
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Seafarers: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Seafarers
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\simple_lcd_menu: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\simple_lcd_menu
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\SmartMatrix3-3.0.1: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\SmartMatrix3-3.0.1
Invalid library found in C:\Users\taran\Documents\Arduino\libraries\Yahzee: no headers files (.h) found in C:\Users\taran\Documents\Arduino\libraries\Yahzee

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

the code is:

/*
   April 15, 2019
   Reddit electronic dice sketch
   This is a electronic dice program for an Uno with a generic 16x2 LCD + keypad shield.
   (The generic shield has resistive buttons; this is *NOT* the Adafruit shield with the MPC23017 i2c expander chip).
 
 
   ...This is a complete re-write of the original sketch, so the order of things is different than before...
 
 
   How this sketch should work:
   1. When no dice value is selected, the display should show two always-changing digits (values from 1 to 6) on the upper line.
      ...One issue here is that LCds can't really change values very fast.
      Under normal circumstances they might require 1/10th of a second to update, and in cold weather they might take 1/4th of a second to update.
      So there will be a delay value used to control how fast new numbers are drawn and written to the LCD.
 
   2. Two random numbers are selected, both with values of 1 to 6, as if one were rolling a pair of normal 6-sided dice.
   2. When the [select] button is pressed, the changing numbers should stop changing.
   3. If the total of the two numbers is not 7, one message is displayed.
   4. If the total of the two numbers is 7, then another message is displayed.
   5. Either of the messages in (3) and (4) is maintained until any of the programmable keypad buttons is pushed again.
 
  There is a 1-second delay after any programmable button press.
  The button-debounce code here is not really the way that I would usually do it, but it is simple and it works reliably.
  There is just a time lag after the button press, before anything happens.
 
*/
 
 
#include <LiquidCrystal.h> // <---------------- This is the standard Arduino IDE library.
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
 
 
int keypad_pin  = A0; // On the generic LCD+keypad shields, this is the Arduino pin that the buttons are connected to.
 
/*
  If you are using the generic shield, then you don't need to use the code below at all.
  This code was carried over from the Adafruit shield sketch out of convenience, when I converted that sketch to work with a generic 16x2LCD + keypad shield.
 
  On the Adafruit shield, I think that each of the numbers of those buttons below corresponds to the pin of the MPC23017 i2c expander chip that each button is connected to.
  The call to read the buttons goes to the MPC23017 chip, it doesn't just use regular Arduino I/O pins (even though there is direct I/O shield pins that could be used).
 
  The generic shield does not use the MPC23017 chip, so there is really no reason to use these defined values.
  #define btnRIGHT  0
  #define btnUP     1
  #define btnDOWN   2
  #define btnLEFT   3
  #define btnSELECT 4
  #define btnNONE   5
*/
 
int random_number_draw_interval = 250; // This is the time in milliseconds to wait between drawing new random numbers, to allow the LCD screen to update.
//                                        Normal LCDs usually take at least 1/10th of a second to change their state, and when cold (below freezing) they can take 1 second or more to change.
//                                        If you don't give them long enough to change, then you don't really see anything displayed. You just faint flickering that can't be identified as any character.
 
int random_number = 0; // This is the variable for generating the random numbers.
 
int random_seed_pin = A1; // You can use an analog-input pin for a random seed, but the pin must not be connected to anything, so you can't use A0 since the buttons are connected to that.
// Also, analog input pins must start with the letter "A", unless you use the high-integer pin ID numbers.
 
int selected_state = 0; // There is two states that must be identifiable: when no values are selected (zero), and when values are selected (1).
 
// Since the below variables always get used, I would just declare them as globals...
long diceOne = 0;
long diceTwo = 0;
int total_dice = 0;
 
int button_pin_value = 0;
 
 
 
 
 
// setup() cannot be placed inside any other function.
void setup() {
  Serial.begin(9600);
  lcd.begin(16, 2);              // start the LCD library
  lcd.setCursor(0, 0);
  lcd.print("select = dice"); // Message is shortened to less than 17 characters.
  randomSeed(analogRead(random_seed_pin)); // Changed to use named random seed pin number
  Serial.println("Exiting setup()");
}
 
 
 
 
 
// loop() cannot be placed inside any other function.
void loop() {
  if (selected_state == 0) {
    // As long as no number has been selected, this is the code that gets run.
    roll_the_dice();
    print_rolling_dice_to_LCD();
    // The line below makes the sketch wait long enough to see the random values appearing on the LCD screen.
    delay(random_number_draw_interval);
  }
  else { // if (selected_state == 1)
    // There is not anything to do here.
    // The important thing is that the code above gets skipped when selected_state is not zero.
  }
 
  read_LCD_buttons();
 
  Serial.print("button value = ");
  Serial.println(button_pin_value);
 
}
 
 
void roll_the_dice() {
  diceOne = random(1, 7);
  diceTwo = random(1, 7);
  total_dice = diceOne + diceTwo;
}
 
 
void print_rolling_dice_to_LCD() {
  // This function is only for showing the un-selected changing dice values.
  lcd.clear();
  lcd.setCursor(7, 0);
  lcd.print(total_dice);
}
 
 
// read the buttons
int read_LCD_buttons() {
  button_pin_value = analogRead(keypad_pin);      // It is helpful to name your input/output pins, and then to refer to them only by name.
 
  // Below is some troubleshooting code to see what values the buttons are putting out...
  //if (button_pin_value < 900) {
  //Serial.print("button value = ");
  //Serial.println(button_pin_value);
  //}
 
  // my buttons when read are centered at these values: 0, 144, 329, 504, 741
  // we add approx 50 to those values and check to see if we are close
 
  // The below values should work for yours and my shields, although the values are slightly different.
 
  if (button_pin_value < 50) {
    // This is the [right] button value.
    if (selected_state == 1) {
      selected_state = 0;
    }
  }
  else if (button_pin_value > 49 && button_pin_value < 200) {
    // This is the [up] button value.
    if (selected_state == 1) {
      selected_state = 0;
    }
  }
  else if (button_pin_value > 250 && button_pin_value < 350) {
    // This is the [down] button value.
    if (selected_state == 1) {
      selected_state = 0;
    }
  }
  else if (button_pin_value > 450 && button_pin_value < 550) {
    // This is the [left] button value.
    if (selected_state == 1) {
      selected_state = 0;
    }
  }
  else if (button_pin_value > 600 && button_pin_value < 850) {
    // This is the [select] button value.
    // This button must do two different things, depending on if selected_state is set to zero or 1.
    if (selected_state == 0) {
      selected_state = 1;
      display_dice_values(); // This is what happens when the [select] button is pressed, to stop the dice from changing.
    }
    else {
      selected_state = 0;
    }
  }
  else {
    // This is the [none] button value.
 
  }
 
  delay(1000); // This is to prevent the buttons from bouncing.
 
}
 
 
 
void display_dice_values() {
  // First of all, we will generate new dice values one more time, to make sure that the user can't press the button when they see dice values they want:
  roll_the_dice();
  // Clear both LCD lines:
  clear_both_lcd_lines();
  // Now there is two different displays to show, if the total value is 7 or not:
 if (lcd_key == btnSELECT) {
    lcd.clear();
    lcd.setCursor(1,0);
    lcd.print(total_dice);
 }
 
  if (total_dice == 7) {
    lcd.setCursor(7, 0);
    lcd.print(total_dice);
    // print second line
    lcd.setCursor(2, 1);
    lcd.print("the robber");
  }
 
}
 
 
// The LCD already has a command to clear the whole thing,
// but often it is useful to write your own named functions to clear out just one line, or both lines.
void clear_both_lcd_lines() {
  clear_lcd_top_line();
  clear_lcd_bottom_line();
}
 
void clear_lcd_top_line() {
  lcd.setCursor(0, 0);
  lcd.print("                "); // Printing 16 spaces.
}
 
void clear_lcd_bottom_line() {
  lcd.setCursor(0, 1);
  lcd.print("                "); // Printing 16 spaces.
}