Error compiling message

Hi, I have an assignment for one of my engineering classes and I’m pretty new to programming in general, so this error message is pretty foreign to me. Assistance would be great, because I have no idea how I need to clean this up!

Here’s my code:

void setup() {

Serial.begin(9600);
Serial.println(“Program Started…”);

}

void loop() {
int input = 2;
int LightValue;
int val;
pinMode(2, input);
LightValue = analogRead(0);
val = digitalRead(2);
while (val == HIGH){

if(LightValue<=100){
Serial.print(“Alert! Light level is low”);
Serial.println(LightValue, DEC);

}
else if (LightValue>100){
Serial.println(LightValue, DEC);
}
}
delay(100);
}


The error message states that:

(File chain) undefined reference to `Print::write(unsigned char const*, unsigned int)’

c:/program files (File chain) undefined reference to `main’

collect2.exe: error: ld returned 1 exit status

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

Side note: (File chain) is just my rendition of what file ladder it follows; I’d rather that stay anonymous

Welcome to the Forum. There are several files at the top of the Forum that you should read as a first-time poster, including the proper way to post code here. Also, if you press Ctrl-T while the cursor is in the IDE's Source Code window, it will be easier for us to read when you post it using code tags.

The undefined reference to `main' often is a result of an IDE error, either during startup or install. Try restarting the IDE, if that doesn't work, try re-installing the IDE.

int input = 2;
int LightValue;
int val;
pinMode(2, input);

pinMode() calls usually go in setup(), not loop(). The second argument is usually INPUT, INPUT_PULLUP, or OUTPUT.

You can declare and initialize a variable in one step:

   int LightValue = analogRead(0);

You did not mention which board you are compiling for. For a Uno, I get:

Sketch uses 2320 bytes (7%) of program storage space. Maximum is 32256 bytes.
Global variables use 230 bytes (11%) of dynamic memory, leaving 1818 bytes for local variables.

which is what most people strive for.