Sorry for this newbie question, but what do libraries exactly do ? Why do I have to #include a header file *AND* at the same time tell the compiler to link some libraries?

In the past I've been coding in Delphi and there was no need for libraries, at least not that I am aware of.
i.e. to get access to all external winsock.dll functions, all I had to do is inlcude the winsock.pas file. This file contained all neccessary data types as well as procedure prototypes that were linked to the appropriate DLL function (i.e. function accept; external WINSOCK_DLL name 'accept'; )

As far as I can tell with my limited C++ knowledge, a header file contains almost the same data, so what are those libraries used for ? What kind of additional code is neccessary in C++ to access a DLL?