.LIB 和 .OBJ 文件有什么区别?(Visual Studio C++)

What is the difference between .LIB and .OBJ files? (Visual Studio C++)(.LIB 和 .OBJ 文件有什么区别?(Visual Studio C++))

本文介绍了.LIB 和 .OBJ 文件有什么区别?(Visual Studio C++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 .OBJ 是编译一个编译单元的结果,.LIB 是一个静态库,可以从几个 .OBJ 创建,但这种区别似乎只在编译单元的数量上.还有其他区别吗?是相同还是不同的文件格式?

I know .OBJ is the result of compiling a unit of compilation and .LIB is a static library that can be created from several .OBJ, but this difference seems to be only in the number of units of compilation. Is there any other difference? Is it the same or different file format?

当我想知道在两个(或更多).LIB 中定义的相同静态变量是否在链接到最终可执行文件期间被合并时,我遇到了这个问题.对于 .OBJ,变量被合并.但在 .LIB 中是否也一样?

I have come to this question when wondering if the same static variable defined in two (or more) .LIBs is merged or not during linking into the final executable. For .OBJs the variables are merged. But is it the same in .LIBs?

推荐答案

.LIB 文件是与索引连接在一起的 .OBJ 文件的集合.链接器的处理方式也应该没有区别.

A .LIB file is a collection of .OBJ files concatenated together with an index. There should be no difference in how the linker treats either.

这篇关于.LIB 和 .OBJ 文件有什么区别?(Visual Studio C++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:.LIB 和 .OBJ 文件有什么区别?(Visual Studio C++)

基础教程推荐