In C or C++, does the compiler do implicit linking?

  c++, compiler-construction, linker

How does some std-lib, external-libs or any other pre-compiled src code such as the well-known header file <iostream> with its corresponding object file or static/dll lib get linked into my own obj file automatically? Does the compiler do it implicitly/under-the-hood or something like a compiler pre-linked list operation?

If such a case exist how do we use its functionality in our accord, Is there a way to put my own obj/dll/static-lib/src file into that ideal list via writing some special syntax without changing the initial directories of each of it, neither the help of an IDE and outside-software, My goal is to drop linking phase explicitly.

// a.cpp
#include<iostream>

// there's no linking on iostream obj/src/dll/static-lib file
// love to have this kind of special features in our own none-std-lib/etc.
>c/cpp-compiler -c a.cpp
>c/cpp-compiler -o a a.o

Does every std-lib or external-lib has a direct/inline special src-code running in the background that does this feature for you? Or if everything is done by a compiler, then how do we take advantage of it?

Source: Windows Questions C++

LEAVE A COMMENT