wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.XX.tar.gz 

tar zxvf bcm2835-1.8.tar.gz

cd bcm2835-1.8

Run the configure exe

./configure

Execute the makefile

make

Then

# as root:

Then

make check

Then

sudo make install


# download the latest version of the library, say bcm2835-1.xx.tar.gz, then:
* tar zxvf bcm2835-1.xx.tar.gz
* cd bcm2835-1.xx
* ./configure
* make
* sudo make check
* sudo make install
* 

#include <bcm2835.h>

When you compile you also need to include -lbcm2835 so the libraries object file is added to the final compilation.
For example at the command line:

gcc clk.c -o clk -lbcm2835

In a simple makefile for a project with a single file called main.c:


all: output_file_name

output_file_name: main.o
	gcc main.o -lbcm2835 -o output_file_name

main.o: main.c
	gcc -c main.c

clean:
	rm -rf *o output_file_name


cd examples/blink
gcc -o blink -l rt blink.c -l bcm2835 

and then run the blink exe with this command:


sudo ./blink
	

	bcm2835_gpio_set(RPI_V2_GPIO_P1_03);
	bcm2835_gpio_clr(RPI_V2_GPIO_P1_03);

 	
#include <bcm2835.h>

// Blinks on RPi pin GPIO 11
#define PIN RPI_GPIO_P1_11

int main(int argc, char **argv)
{
    if (!bcm2835_init())
	return 1;

    // Set the pin to be an output
    bcm2835_pio_fsel(PIN, BCM2835_GPIO_FSEL_OUTP);

    // Blink
    while (1)
    {
	// Turn it on
	bcm2835_gpio_write(PIN, HIGH);
	
	// wait a bit
	delay(500);
	
	// turn it off
	bcm2835_gpio_write(PIN, LOW);
	
	// wait a bit
	delay(500);
    }
    return 0;
}	
	
	
	  gcc -o blink blink.c -lwiringPi
	  
	int piHiPri (int priority);
	int waitForInterrupt (int pin, int timeOut) ;
    int wiringPiISR (int pin, int edgeType,  void (*function)(void)) ;
	int piThreadCreate (name) ;
	  
	  -lwiringPiDev
	  
	 #include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <wiringPi.h>


// Use GPIO Pin 17, which is Pin 0 for wiringPi library

#define BUTTON_PIN 0


// the event counter
volatile int eventCounter = 0;

// -------------------------------------------------------------------------
// myInterrupt:  called every time an event occurs
void myInterrupt(void) {
   eventCounter++;
}


// -------------------------------------------------------------------------
// main
int main(void) {
  // sets up the wiringPi library
  if (wiringPiSetup () < 0) {
      fprintf (stderr, "Unable to setup wiringPi: %s\n", strerror (errno));
      return 1;
  }

  // set Pin 17/0 generate an interrupt on high-to-low transitions
  // and attach myInterrupt() to the interrupt
  if ( wiringPiISR (BUTTON_PIN, INT_EDGE_FALLING, &myInterrupt) < 0 ) {
      fprintf (stderr, "Unable to setup ISR: %s\n", strerror (errno));
      return 1;
  }

  // display counter value every second.
  while ( 1 ) {
    printf( "%d\n", eventCounter );
    eventCounter = 0;
    delay( 1000 ); // wait 1 second
  }

  return 0;
}

 http://ceptimus.co.uk/?p=91    capture video

http://www.raspberrypi-spy.co.uk/2013/05/creating-timelapse-videos-with-the-raspberry-pi-camera/ 
	  