Errors when compiling an Arduino sketch in Atmel Studio 6.1

Hi, I was trying to use the Atmel Studio for compiling Arduino sketches but I keep getting this error,

pins_arduino.h: No such file or directory	C:\Arduino\hardware\arduino\cores\arduino\Arduino.h	213	26	ArduinoCPP

I've setup the Toolchain to point to the Arduino 'Core', 'Standard' and SoftwareSerial libraries. I included the core.a library after building a sketch through the Arduino IDE. I setup the Symbols to include F_CPU=16000000L and ARDUINO=100. Under Misc I added -fno-exceptions.

Here is the .CPP code,

#include <avr/io.h>
#include <Arduino.h>

// digital pin 2 has a pushbutton attached to it. Give it a name:
int pushButton = 2;

// the setup routine runs once when you press reset:
void setup() {
	// initialize serial communication at 9600 bits per second:
	Serial.begin(9600);
	// make the pushbutton's pin an input:
	pinMode(pushButton, INPUT);
}

// the loop routine runs over and over again forever:
void loop() {
	Serial.println("Start of loop");
	// read the input pin:
	int buttonState = digitalRead(pushButton);
	// print out the state of the button:
	Serial.println(buttonState);
	delay(1);        // delay in between reads for stability
}

int main(void)
{
    while(1)
    {
        setup();
	loop();
    }
}

What am I doing wrong here? Why am I getting this error?

Because you need to use the Arduino IDE to compile Arduino sketches.

hrishib:
I've setup the Toolchain to point to the Arduino 'Core', 'Standard' and SoftwareSerial libraries.

Assuming you are running on a 64-bit Windows system, you need to add "C:\Program Files (x86)\Arduino\hardware\arduino\variants\X" to the include path, where X is one of standard, mega, micro or leonardo (depending on what board or chip you are writing for).

I had similar issues with "no such file or directory" using DUE board on Atmel Studio 7. Though it´s not arduino IDE related, Atmel Studio needs to know the path to include.

May this help any newbie like me: Atmel Studio "no such file or directory" - YouTube

Good luck.