如何向 .pro 文件添加额外的 dll?

发布于 2024-09-18 13:05:11 字数 205 浏览 2 评论 0原文

我正在为我的项目使用 Visual Studio,并且我需要在我的应用程序中包含 lib/dll。我已经包含了相同的 lib 并编译得很好,但是当我尝试运行它时,给我一个错误,说它找不到指定的 dll,在环境变量 PATH 中添加此路径可以解决问题,但我不想要每次跨系统执行此操作,我如何在我的 .pro 文件本身中包含此路径或相同的解决方法?

预先感谢,这是一个非常紧急的事情。

am using visual studio for my project, and i need to include a lib/dll in my application. i have included the lib for the same and compiles fine, however when i try to run it, gives me an error saying that it could not find the specified dll, adding this path in the env variable PATH solves the issue, but i do not want to do it everytime and across systems, how can i include this path or a workaround for the same in my .pro file itself?

Thanks in advance, this is a li'l urgent.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

霞映澄塘 2024-09-25 13:05:11

您遇到此问题是因为您的可执行文件和 dll 位于不同的文件夹中。您可能使用默认的 Visual Studio 设置,该设置在每个项目文件夹中使用 $(IntDir) 和 $(OutDir)。

将两个项目(exe 和 dll)的 OutDir 设置为同一文件夹(例如 $(SolutionDir)\Build\$(TargetName) )。这样,构建解决方案时生成的二进制文件将放置在同一文件夹中(不同目标的不同输出文件夹 - 调试/发布)。

You have this problem because your executable and your dll are in different folders. You probably used the default visual studio setup, which uses $(IntDir) and $(OutDir) in each project folder.

Setup the OutDir for both projects (exe and dll) to be the same folder (e.g. $(SolutionDir)\Build\$(TargetName) ). This way, the binaries resulted when building the solution will be placed in the same folder (different out folders for different targets - Debug/Release).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文