Error Code For Running Programs [solved]

I'm sort of new to arduino and I have run into a strange problem. I have been working on projects using my Arduino in class for half of this semester. I have programmed and run numerous items including LCD, speaker, lights, Ultrasonic sensor, motor, etc. So, you can sort of see where I stand. I have wired and programmed all of these items and made them work but today, for some reason they don't work. I was trying to program my LCD to the basic program of "Hello World" and it doesn't work. I hit Ctrl+T and it says "No changes necessary for Auto Format." So, that is one thing that doesn't work. I then opened old programs that I ran and worked like the basic program of "Blink". That didn't work either. FYI... Yes, my arduino IS plugged in and it lights up. I have it hooked up with a 10K potentiometer.

This is my code:

Turns an LED on for one second, then off for one second, repeatedly.

Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:

modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman

This example code is in the public domain.


// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(20); // wait for a second

(This is the sample code as you can see.)
My error code that I get is this:

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to `main'

collect2.exe: error: ld returned 1 exit status

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

Yes, same error code as all other programs I run.

Hopefully someone has more brains than me and can see what I am missing!! :slight_smile:

your code loaded and ran for me. And I verified the blink rate after changing the following. the delay() argument is in msec.

delay(20);                       // wait for a second

Okay, I did that, changed it to 20 msec. Sad part is, it didn't work at all. :confused:

I pretty much just let it sit over night and closed the program... Hopefully this doesn't happen to anyone else but if it does, just simply try re-starting your program and hope for the best. (I did restart my program originally and it still gave me the error) I don't know what I did, but now it works! :slight_smile: