Original Post
Hi all: I have a problem while building a shared library. I declared my function prototype in the header file and wrote the function definition in a cpp file. It compiles without a problem. But when I tried to link to the library, the compiler complains that it can't find the function definition: It works if I move the function definition to the header file. Is it the only way to make it work? Or is it possible to separate declaration and definition in different file? Are the routines in header compiled? Does it affect the performance? If writing in header file equals to write in cpp file, why do we bother to have another file really? Could someone answer my questions please? Thanks
undefined reference to ....