i created a header file for class, it contains add() function save it as a abc.h.i created abc.cpp file which contains a defination of add function.if i include this abc.h header file in another program,why it is showing add function as a undefined reference..
The function is compiled and exists in the first program/library. When you include abc.h in another program, that tells the compiler that you have a definition somewhere and it will be resolved at link time. But you don't tell the linker where to find it.
This means that the first unit should be a library, and the second unit a might be a program that uses that library.