static libraries - What is the relationship of .lib and .obj to each other and my project in c++? -


How do .lib and .obj files relate to each other? What is their purpose? Is a .lib just a collection of .obj files? If so, then .obj is stored inside .lib to make unnecessary .obj?

Typically, .obj files object files . This is a source file in its compiled form, for example, from a main.cpp and foo.cpp to main.obj and Foo.obj will be generated.

Then it is the work of linkers to link them together, so that in the main.obj the function can be defined in the foo.obj And vice versa. The linker will produce your binary file, which will be .lib (or .a , or .exe , or .dll``, etc., etc.) Will happen. ).

Then in a loose sense, yes, the binary output ( .lib in your case) is linked to .obj once the collection of files If you want to finish the compilation, and use the library, then you only need other programs to link to .lib . .obj is considered intermediate files, and after linking it is not needed.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -