   Build shared library problem
  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:undefined reference to ....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   
  Your library will compile into a .lib file. You need to link with this file to resolve those external symbol references.   ;  I am actually using c++ in Linux, I didn't see any lib files but some .a files.   ;  The principle is still the same. In order to use a library in an executable you need to link the library file in when building the executable.This may help.   ;  I still can't find it. Really don't know how to solve it. I am using Eclipse-CDT to write C++ program. I think all the libraries should be linked and included correctly, but it just doesn't work.Anybody know how to link a static library in Eclipse???   ;  The make file looks like this:g++ -L"/local/d0p6/ming/Project/C++/mesh_structure/Release" -o"smf2ply"  ./smf2ply.o   -llibmesh_structurethe library file is right in the directory, but the compiler just complains /usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../i486-slackware-linux/bin/ld: cannot find -llibmesh_structureAlso I tried g++ -L"/local/d0p6/ming/Project/C++/mesh_structure/Release" -o"smf2ply"  ./smf2ply.o   -llibmesh_structure.aBut this gave me the same error.   