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
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 这个宏可以转换成函数吗? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01