What does this error mean and how doI fix it

This is the error message and the code that caused it. The code is for getting a PWM frequ. of 25kHz to run a fan with a PWM wire

core.a(main.cpp.o): In function main': C:\Users\Skip\Desktop\arduino1\arduino-1.0.1\hardware\arduino\cores\arduino/main.cpp:15: undefined reference to loop'

This is the code:

/ Analog output (i.e PWM) pins. These must be chosen so that we can change the PWM frequency without affecting the millis()
// function or the MsTimer2 library. So don't use timer/counter 1 or 2. See comment in setup() function.
// THESE PIN NUMBERS MUST NOT BE CHANGED UNLESS THE CODE IN setup(), setTransistorFanSpeed() AND setDiodeFanSpeed() IS CHANGED TO MATCH!

// On the Mega we use OC1B and OC1C
const int transistorFanPin = 12;     // OC1B
const int diodeFanPin = 13;          // OC1C


// Definitions for PWM fan control
const unsigned char maxFanSpeed = 80;   // this is calculated as 16MHz divided by 8 (prescaler), divided by 25KHz (target PWM frequency from Intel specification) 

void setup()
{
  // Set up the PWM pins for a PWM frequency close to the recommended 25KHz for the Intel fan spec.
  // We can't get this frequency using the default TOP count of 255, so we have to use a custom TOP value.
  


  // Only timer/counter 1 is free because TC0 is used for system timekeeping (i.e. millis() function),
  // and TC2 is used for our 1-millisecond tick. TC1 controls the PWM on Arduino pins 9 and 10.
  // However, we can only get PWM on pin 10 (controlled by OCR1B) because we are using OCR1A to define the TOP value.
  // Using a prescaler of 8 and a TOP value of 80 gives us a frequency of 16000/(8 * 80) = 25KHz exactly.
 

  // On the Mega we use TC1 and OCR1B, OCR1C
  TCCR1A = (1 << COM1B1) | (1 << COM1B0) | (1 << COM1C1) | (1 << COM1C1) | (1 << WGM11) | (1 << WGM10);  // OC1A disconnected, OC1B = OC1C inverted fast PWM  
  TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS11);  // TOP = OCR1A, prescaler = 8
  TCCR1C = 0;
  OCR1AH = 0;
  OCR1AL = 79;  // TOP = 79

  OCR1BH = 0;
  OCR1BL = maxFanSpeed;
  OCR1CH = 0;
  OCR1CL = maxFanSpeed;
  
  TCNT1L = 0;

  
  // We have to enable the ports as outputs before PWM will work.
  pinMode(transistorFanPin, OUTPUT);
  pinMode(diodeFanPin, OUTPUT);
}

// Set the transistor fan speed, where 0 <= fanSpeed <= maxFanSpeed
void setTransistorFanSpeed(unsigned char fanSpeed)
{
  OCR1BH = 0;
  OCR1BL = fanSpeed;
}

// Set the diode fan speed, where 0 <= fanSpeed <= maxFanSpeed
void setDiodeFanSpeed(unsigned char fanSpeed)
{

  OCR1BH = 0;
  OCR1BL = fanSpeed;

  OCR1CH = 0;
  OCR1CL = fanSpeed;

}

The original code was for a UNO or Mega, I have the mega so I deleted the UNO code. I was getting a whole bunch of errors.
Here is the original code.

// Definition of Arduino type
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define  IS_MEGA  (1)
#define  IS_UNO   (0)
#else
#define  IS_MEGA  (0)
#define  IS_UNO   (1)
#endif

// Analog output (i.e PWM) pins. These must be chosen so that we can change the PWM frequency without affecting the millis()
// function or the MsTimer2 library. So don't use timer/counter 1 or 2. See comment in setup() function.
// THESE PIN NUMBERS MUST NOT BE CHANGED UNLESS THE CODE IN setup(), setTransistorFanSpeed() AND setDiodeFanSpeed() IS CHANGED TO MATCH!
#if IS_UNO
// On the Uno we can only use the OC1B pin, so these pin numbers are both 10
const int transistorFanPin = 10;     // OC1B
const int diodeFanPin = 10;          // OC1B
#else
// On the Mega we use OC1B and OC1C
const int transistorFanPin = 12;     // OC1B
const int diodeFanPin = 13;          // OC1C
#endif

// Definitions for PWM fan control
const unsigned char maxFanSpeed = 80;   // this is calculated as 16MHz divided by 8 (prescaler), divided by 25KHz (target PWM frequency from Intel specification) 

void setup()
{
  // Set up the PWM pins for a PWM frequency close to the recommended 25KHz for the Intel fan spec.
  // We can't get this frequency using the default TOP count of 255, so we have to use a custom TOP value.
  
#if IS_UNO

  // Only timer/counter 1 is free because TC0 is used for system timekeeping (i.e. millis() function),
  // and TC2 is used for our 1-millisecond tick. TC1 controls the PWM on Arduino pins 9 and 10.
  // However, we can only get PWM on pin 10 (controlled by OCR1B) because we are using OCR1A to define the TOP value.
  // Using a prescaler of 8 and a TOP value of 80 gives us a frequency of 16000/(8 * 80) = 25KHz exactly.
  TCCR1A = (1 << COM1B1) | (1 << COM1B0) | (1 << WGM11) | (1 << WGM10);  // OC1A (pin 9) disconnected, OC1B (pin 10) = inverted fast PWM  
 #ifdef FAN_AUDIO_TEST
  // test code to get 440Hz output (= concert A) to test the logic 
  OCR1AH = 0;
  OCR1BL = 71;  // 50% duty cycle 
  TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS12);  // TOP = OCRA, prescaler = 256

  OCR1AL = 141; // TOP = 141, 16000000 / (256 * 142) = 440.014
  OCR1BH = 0;
 #else
  OCR1AH = 0;
  OCR1AL = 79;  // TOP = 79
  TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS11);  // TOP = OCR0A, prescaler = 8

  OCR1BH = 0;
  OCR1BL = maxFanSpeed;  // max fan speed (i.e. pin 5 initially low all the time)  
 #endif

  TCNT1H = 0;
  TCNT1L = 0; 
#else

  // On the Mega we use TC1 and OCR1B, OCR1C
  TCCR1A = (1 << COM1B1) | (1 << COM1B0) | (1 << COM1C1) | (1 << COM1C1) | (1 << WGM11) | (1 << WGM10);  // OC1A disconnected, OC1B = OC1C inverted fast PWM  
  TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS11);  // TOP = OCR1A, prescaler = 8
  TCCR1C = 0;
  OCR1AH = 0;
  OCR1AL = 79;  // TOP = 79

  OCR1BH = 0;
  OCR1BL = maxFanSpeed;
  OCR1CH = 0;
  OCR1CL = maxFanSpeed;
  
  TCNT1H = 0;
  TCNT1L = 0;
#endif
  
  // We have to enable the ports as outputs before PWM will work.
  pinMode(transistorFanPin, OUTPUT);
  pinMode(diodeFanPin, OUTPUT);
}

// Set the transistor fan speed, where 0 <= fanSpeed <= maxFanSpeed
void setTransistorFanSpeed(unsigned char fanSpeed)
{
  OCR1BH = 0;
  OCR1BL = fanSpeed;
}

// Set the diode fan speed, where 0 <= fanSpeed <= maxFanSpeed
void setDiodeFanSpeed(unsigned char fanSpeed)
{
#if IS_UNO
  OCR1BH = 0;
  OCR1BL = fanSpeed;
#else
  OCR1CH = 0;
  OCR1CL = fanSpeed;
#endif

Thanks any help would be great

You forgot the loop() function in your code. Even if you don't use it, you must put:

void loop(){
}

somewhere in your code.

We should write up an issue on that. Neither startup() nor loop() shouldn't be needed if you don't use them.

They aren't if you use int main(){}

The default version of main calls these functions, causing the error.

pYro_65:
They aren't if you use int main(){}

I know that. But Daka101 used setup(), so he must use loop() as well. Also, if you prefer to use main() instead, you must also put:

using namespace std;

above main(). I think that the default main() in the Arduino is something like this:

int main(){
  setup();
  while(1) loop();
  return 0;
}

So if you don't define setup() or loop(), it will cause a compiler error, because the function was called, but not defined.

Also, if you prefer to use main() instead, you must also put:
Code:

using namespace std;

above main().

int main ()
{
  return 0; 
}

176 bytes. IDE 1.0

You can leave out the "return" if you like, but it still comes in at the same size.

main.cpp in 1.0.1:

#include <Arduino.h>

int main(void)
{
        init();

#if defined(USBCON)
        USBDevice.attach();
#endif

        setup();

        for (;;) {
                loop();
                if (serialEventRun) serialEventRun();
        }

        return 0;
}

I thought that you needed the namespace thing, because I tried to program Arduino in [almost] pure c++:

#include <StandardCplusplus.h>
#include <vector>
int main(){
  vector <int> vec;
  for(byte i = 0; i < 10; i++){
    vec[i] = random(1, 100);
  }
  return 0;
}

Compiler Error:
sketch_jun11a.cpp: In function 'int main()':
sketch_jun11a:3: error: 'vector' was not declared in this scope
sketch_jun11a:3: error: expected primary-expression before 'int'
sketch_jun11a:3: error: expected `;' before 'int'
sketch_jun11a:5: error: 'vec' was not declared in this scope

Changing the code to this will fix that error:

#include <StandardCplusplus.h>
#include <vector>
using namespace std;
int main(){
  vector <int> vec;
  for(byte i = 0; i < 10; i++){
    vec[i] = random(1, 100);
  }
  return 0;
}

Vectors are part of the std namespace. You need the std namespace for most things in C++, but it's not a requirement for absolutely everything.

As a rule I always add it when working in pure C++.

There is not much different in code size when using setup and loop within your own int main. The purpose of using int main rather than the standard way is to avoid the function calls.

Do not use setup and loop if using main, 100% defeats any benefit of using main. no namespaces are required for int main.
Std namespace is only required to access std elements, no restrictions on c++.

Look at it from the OP's perspective, though. If a person does not know about loop(), they certainly do not know about main(). It's a one-line fix in the core to make loop optional.

void loop() __attribute__ ((weak)) {}

Can you also do that to make the setup() optional?

I have met this problem before,
that's because my sketch's name is "main.ino"
may be I can not use the word "main"
and I change to another name.
and then problem solve.

You can't name your sketch the same as any of the files within the core. main.ino gets parsed into main.cpp - that conflicts with the main.cpp file in the core, and breaks the whole system.

Other ones you won't be able to use include "new.ino", "Print.ino", "IPAddress.ino", "HID.ino"... etc.