Ethernet Shield SD card will not intialize

Hello,

I get the following error message and the serial monitor will tell me that the SD card initialization has failed:

undefined reference to `loop’

collect2: error: ld returned 1 exit status

exit status 1

I am using the following code:

#include <SD.h>
File file;
const long runningTime = 5; // time in minutes
const long msMin = 60000; // milliseconds in 1 minute
const int interval = 2000; // time in milliseconds
const int sensorMin = 30;
const int sensorMax = 1000;
const int sensor = A0;
const int SDcs = 4;
void setup() {
Serial.begin(9600);
Serial.print(“Initializing SD card…”);
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
if (!SD.begin(SDcs)) {
Serial.println(“initialization failed!”);
return;
} else{
Serial.println(“initialization done.”);}
file = SD.open(“data.ext”, FILE_WRITE);
if (file) {
while (millis() < (runningTime * msMin)) {
byte value = map(analogRead(sensor), sensorMin, sensorMax, 0, 255);
Serial.print("Writing “);
Serial.print(value, DEC);
Serial.print(” to data.ext… ");
file.write(value);
Serial.println(“done.”);
delay(interval);
}
file.close();
Serial.println(“File closed.”);
} else {
Serial.println(“Error opening data.ext.”);
}
}

Can anyone help?

Please use code tags to post your code.

The linker is telling you that you did not define the function 'loop' which is required in Arduino sketches. If you open a new, blank sketch, you will see 'void setup()' and 'void loop()' as the two functions that are required.

Thank you!