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

查看:887
本文介绍了.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 ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆