为什么我的程序查找 Commons.dll 而不是 Commons.lib?

Why does my program look for Commons.dll instead of Commons.lib?

在项目属性 -> 链接器 -> 输入 -> 附加依赖项中我引导编译器寻找 Commons.lib

此外, 在 VC++ 目录 -> 我添加了 $(SolutionDir)\Debug 的库目录,其中可以找到 Commons.lib

然而,由于某些原因,当 运行 它试图寻找的项目 Commons.dll 但失败了。

为什么?

消息如下:

The program can't start because Commons.dll is missing from your computer. Try reinstalling the program to fix this problem.

有些库是所谓的导出库,它只包含 DLL 中函数的存根。为了能够使用库,必须加载 DLL。

链接器使用该库作为构建过程的一部分,并且在加载要执行的程序时由 Windows(或等价物)加载 DLL。