how to use cpp files in arduino project

hi Iam planning to use this example code to implement I2C keypad http://playground.arduino.cc/Main/I2CPortExpanderAndKeypads

this code has a header file i2ckeypad.h and a cpp file i2ckeypad.cpp . now if i write a program to use this library how do i include it in my code ? I know how to include the header files but how to link with the .cpp file ?

the example code given in the link above does not also link to this i2ckeypad.cpp file in any way so how does it find the routines from this library ?

thanks

the example code given in the link above does not also link to this i2ckeypad.cpp file in any way so how does it find the routines from this library ?

It expects the .h and .cpp files to be in a folder named i2ckeypad in the Arduino libraries folder. The library folder in question is the one in the folder where your programs are filed (assuming Windows) not the one under Program Files\Arduino. Once the library is installed you must stop and start the IDE to make it available via sketch/Import Library in teh IDE

aliyesami: I know how to include the header files but how to link with the .cpp file ?

You will put the .cpp and .h files in the appropriate library directory and #include the .h file in your sketch. Under the covers the Arduino IDE will notice that your sketch is #including a .h file, find the library where that file resides and include all the other source files in that library in the sketch build process.

thank you both for your valuable advise.