Why do we need to add both includes and libs to the compilation?
Why doesn't the libs wrap everything in it?
Why do we need to add both includes and libs to the compilation?
Why doesn't the libs wrap everything in it?
A header file (usually) only contains declarations for classes and functions. The actual implementations are built from CPP files. You can then link against those implementations with only the header declarations available.
I'm guessing this is your way of handling the question you asked at http://stackoverflow.com/questions/2516187/how-to-make-include-mysql-h-work
Unfortunately, I think the better solution is to either learn more about C++, or learn more about Google, before posting absolutely everything to this site.
Header files define interfaces; libraries provide implementations.
The header for a library is going to tell your compiler the names and signatures of functions provided by the library, the names of variables provided by the library, and the layout of classes provided by the library.
The library itself is compiled code which is executed at run time. Using the header during compilation allows your compiler to generate compiled code which knows how to invoke and communicate with the existing library code.