源文件中的静态和动态链接(windows build compiler) - 链接器错误 [英] Static and dynamic linking in sources file(windows build compiler) - linker errors

查看:109
本文介绍了源文件中的静态和动态链接(windows build compiler) - 链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在使用win7构建环境并使用目录和源文件组织代码。我使用windows build命令来构建源文件。在我的发展过程中,我遇到了一个问题。让我来描述一下这个场景。



ProjectA.dll,ProjectA.lib - 这是一个带有.lib和头文件的第三方DLL。我们将此ProjectA.dll包含在内,以构建一个新的静态库ProjectB.lib。直到这里编译工作正常。



现在我的要求是在第三个项目ProjectC中使用静态库ProjectB.lib,它将生成一个DLL。所以我将ProjectB.lib包含在TARGETLIBS部分的ProjectC源文件中。但是在构建ProjectC时,它为ProjectA.dll中的函数提供了未解决的外部符号错误,并在ProjectB.lib中使用。这个链接器错误显示在构建命令输出中的ProjectB.lib中。



我无法弄清楚这里缺少什么。



请帮忙。任何建议都将受到高度赞赏。



请让我知道我无法正确解释这个场景。



问候



Rahul



我尝试过:



我在问题描述中描述的所有

Hi All,

I am using win7 build environment and have organized code using dirs and sources file. I use windows build command to build source files. During my development i am facing a issue. Let me describe the scenario.

ProjectA.dll, ProjectA.lib - This is a third party DLL with its .lib and header. We are including this ProjectA.dll to build a new static library ProjectB.lib. Till here compilation is working fine.

Now my requirement is to use static library ProjectB.lib in a third project ProjectC which will generate a DLL. So I have included ProjectB.lib in ProjectC' s sources file in TARGETLIBS section. But while building ProjectC, it is giving unresolved external symbol error for the functions which are in ProjectA.dll and used in ProjectB.lib. This linker error is showing in ProjectB.lib in build command output.

I am not able to figure out what is missing here.

Please help. Any suggestions would be highly appreciated.

Please let me know i am not able to properly explain the scenario.

Regards

Rahul

What I have tried:

All i have described in problem description

推荐答案

您必须在ProjectC中完整地包含您的第三方文件,因为它在ProjectB中没有静态链接。
You must include your third party files completly in the ProjectC, because it isnt linked staticly in the ProjectB.


这篇关于源文件中的静态和动态链接(windows build compiler) - 链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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