What is the difference between .LIB and .OBJ files? (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++)
基础教程推荐
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- CString 到 char* 2021-01-01
