The environment discussed below is based on Visual Studio 2010.
In the process of using OPENCV, we not only specify the header file and library directory, but also specify the name of the library, for example, in order to use common basic functions, we need to specify additional Libopencv_highgui249.dll.
In contrast, in the process of using the C + + Boost Library, we only need to specify the directory and library directory of the header file, and we do not have to specify additional dependencies (that is, the name of the specified library). If we include the BOOST/TIMER/TIMER.HPP header file and use the/MD compile option, Boost will automatically link the libboost_date_time-vc100-mt-1_57.lib to us. This process is called auto-linking.
In Wikipedia, here's what auto-linking says:
auto-linking is a mechanism for automatically determining which libraries to link to while building a C, C + + or O Bj-c program. It is activated by means of #pragma comment (lib, <name>)statements in the header files of the library, or c3> @import <name> depending on the compiler.
Most Windows compilers support auto-linking, as does Clang, while GCC does not support auto-linking< /c5> [1]
Most Windows compilers support auto-linking, and GCC does not support auto-linking. So in the GCC environment, we probably have to specify additional dependencies (the library name) ourselves.
In the boost documentation, we can find a description of auto-linking:
Auto-linking
Most Windows compilers and linkers has so-called "auto-linking support," which eliminates the second challenge. Special code in Boost header files detects your compiler options and uses, information to encode the name of the Corr ECT library into your object files; The linker selects the library with this name from the directories you ' ve told it to search.
The GCC toolchains (Cygwin and MinGW) are notable exceptions; GCC users should refer to thelinking instructions for Unix variant OSes for the appropriate command-line options to use.
The second challenge here means a task that specifies the name of the library.
Since there is special code in the Boost header file (which I think is probably some #pragma comment (lib, <name>), we do not need to specify the name of the library ourselves, Linker will find itself in the library directory we specify.
Of course, it also says that the GCC toolchain is a notable exceptions.
About Auto-linking