coping project from arduino to eclipse

Hey guys i have Somme issue im new to this programing, i wrote a simple led project in Arduino and now i wont to copy that project to eclipse but i get this error:

**** Build of configuration 328P_16MHz for project LCD ****

make all 
Building file: ../main.cpp
Invoking: AVR C++ Compiler
avr-g++ -I"D:\Dokumenty\Dev\eclipse\LCD\src\Arduino Lib" -Wall -g2 -gstabs -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF"main.d" -MT"main.d" -c -o "main.o" "../main.cpp"
../main.cpp:3: error: 'byte' does not name a type
../main.cpp: In function 'void setup()':
../main.cpp:12: error: 'ledPin' was not declared in this scope
../main.cpp:12: error: 'OUTPUT' was not declared in this scope
../main.cpp:12: error: 'pinMode' was not declared in this scope
../main.cpp:13: error: 'millis' was not declared in this scope
../main.cpp: In function 'void loop()':
../main.cpp:17: error: 'analogRead' was not declared in this scope
../main.cpp:18: error: 'millis' was not declared in this scope
../main.cpp:19: error: 'changeLED' was not declared in this scope
../main.cpp: In function 'void changeLED()':
../main.cpp:26: error: 'ledPin' was not declared in this scope
../main.cpp:26: error: 'LOW' was not declared in this scope
../main.cpp:26: error: 'digitalWrite' was not declared in this scope
../main.cpp:28: error: 'ledPin' was not declared in this scope
../main.cpp:28: error: 'HIGH' was not declared in this scope
../main.cpp:28: error: 'digitalWrite' was not declared in this scope
make: *** [main.o] Error 1

**** Build Finished ****

is some one could help me in explaining what is this "scope"
(in C++ programing im a pro nOOb)

A scope is a place where you [can] declare things. For example, a function has a scope because you can declare things inside the function.

The first error you showed makes me suspect that you're missing an include file that declares the 'byte' type. It's probably declared in an include file that the Arduino includes automagically for you while doing its magic, but Eclipse of course doesn't.

You do need to manually include at least one file but I can't remember what it is (Arduino.h ?).

That would explain the UPPER CASE errors like HIGH as they are Arduino-specific definitions.

However many of the other errors are presumably for your own variables etc and they should be good unless you have forward references (that are automatically handled by the IDE).

Can you post the code?


Rob

ye sure this is the code

byte ledPin[] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; // Create array for LED pins
int ledDelay; // delay between changes
int direction = 1;
int currentLED = 0;
unsigned long changeTime;
int potPin = 2; // select the input pin for the potentiometer




void setup() {
for (int x=0; x<10; x++) { // set all pins to output
		pinMode(ledPin[x], OUTPUT); }
	changeTime = millis();
}

void loop() {
ledDelay = analogRead(potPin); // read the value from the pot
		if ((millis() - changeTime) > ledDelay) { // if it has been ledDelay ms since last change
			changeLED();
			changeTime = millis();
		}
}

void changeLED() {
	for (int x=0; x<10; x++) { // turn off all LED's
			digitalWrite(ledPin[x], LOW);
	}
	digitalWrite(ledPin[currentLED], HIGH); // turn on the current LED
	currentLED += direction; // increment by the direction value
	// change direction if we reach the end
	if (currentLED == 9) {direction = -1;}
	if (currentLED == 0) {direction = 1;}
}

on arduino works without a problem

Compiling with Eclipse requires a relatively lengthly setup. You cannot simply copy the code from the Arduino IDE into an eclipse project.

http://arduino.cc/playground/Code/Eclipse