When I want to use something from standard C/C++ library I can just include appropriate header and use that function. The same thing with WinAPI functions.
I understand how compiler finds these headers - it searches them localy then if not found looks up in some predefined system folders.
But I cant figure out how does linker findes those libraries because I dont include them in any way...
If you use Visual Studio 2012 with default settings, in addition to C Runtime, linker will link against the following:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
You can see the list yourself if you right click on project, properties -- linker -- input -- additional dependencies.
You can drop some or add some if you want to.
As for the C Runtime, it is controlled by /NODEFAULTLIB linker option, more details here: https://msdn.microsoft.com/en-us/library/3tz4da4a(v=vs.110).aspx
The linker simply has a standard library coming with the compiler itself.
For example, if you install GNU GCC, then you'll see a folder lib
which contains all of the static libraries the linker uses to link your code.
If you need to tell the linker to use a specific library or some static libraries from somewhere else, you can always use the -l
or -L
flags (for GNU GCC) to indicate that you want the linker to use a specific library or folder of libraries.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.