Visual Studio 静态库编译器硬编码相对路径
我认为我的问题是 Visual Studio 静态库链接器硬编码相对路径,这会在以后从不同目录链接该静态库时导致问题。
这就是我想做的:
在最后一步中,链接失败并显示 LNK1104(无法打开文件),因为它使用的是 application.exe 的相对路径,而不是testing.dll 的相对路径。在此过程的早期,Testing.dll 已成功链接到 base.dll。
有什么建议吗?
I think my problem is that the Visual Studio static library linker hardcodes relative paths, and this causes problems later when linking against that static library from a different directory.
Here's what I'm trying to do:
In the last step, the linking fails with LNK1104 (cannot open file) because it is using the relative path of application.exe, not of testing.dll. Testing.dll has already linked successfully to base.dll earlier in the process.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在每个项目的“库目录”对话框中选中“从父级或项目默认值继承”。
我自己的图书馆项目也遇到过类似的问题,并且没有太多关于此的文档。
Try checking "Inherit from parent or project defaults" in the "Library Directories" dialog for each project.
I have had similar issues with my own library projects, and there is not much documentation out there on this.
诀窍是在构建静态库时不链接到base.dll,而仅在构建testing.dll 时链接到它。
The trick is to not link against base.dll when I build the static library, and only link against it when I build testing.dll.