The problem
Information on how linking works in detail are scarce. Also IDEs hide the details of compilation which is a real pain when you have some linking related problem with your project.
Usually C++ books tell me that
C++ code --> preprocessed c++ code --> object code
But they really do not go into too much detail on what an average developer should know about linking despite the fact, that linking errors are common. How should a fresh C++ programmer know how to tackle an error like the following?
XmlRpcSocket.o:XmlRpcSocket.cpp:(.text+0x48b): undefined reference to `WSAGetLastError@0'
But this question is not specifically about this problem (-lwsock32 solves it). The problem is the lack of general knowledge about linking. My university C++ lecturer talked about linking for the time of one slide with a few black-boxes on it.
Also, resources on how linking works are scarce and most of the people I know still considers linking as a black-box operation. What I have learned about linking is through experimentation, and kinda "picked it up along the way", but the problem with this approach is that it raises more questions than it answers.
For example: I know .LIB files are library files which are bundles of object files. Now, how should one build and use a .LIB file? When is it desirable to use .LIB file? When sould I build static .LIB files or ones that reference DLLs? When I link a .LIB file with my object files do everything gets copied in, or just the object files I use? When should I build DLLs/so files instead of linking statically? Do I have to learn about the inner structure of object files to solve common problems? What do I have to know about name-mangling? When is it relevant? Can I link several different standard libraries with my project if one of the dlls load the old msvcrt? etc.
The question
Obviously I don't expect an answer to all the above listed questions in one go. I just need to know where to start. Is there a resource like "What Every Programmer Should Know About Memory", which talks about linking? So, I need resources to learn from and your insight on which direction should I go to learn about the linking process.
What are the things every developer should know about linking?