使用 Qt Creator 和项目文件,如何使用 QMAKE_POST_LINK 复制创建的 dll/so

发布于 2024-10-08 09:15:08 字数 945 浏览 0 评论 0原文

这个问题似乎在这个步骤中得到了回答

qmake : 如何将 .dll/.so 复制到输出目录?

但它对我不起作用。我正在尝试在 Windows 7 上使用 Qt SDK 4.7.0 在 Qt Creator 2.0.1 中执行此操作

如果我尝试:

QMAKE_POST_LINK=copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt

即使在静态文件上,我得到的输出是:

copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
process_begin: CreateProcess(NULL, copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt, ...) failed.
make (e=2): The system cannot find the file specified.

如果我尝试:

QMAKE_POST_LINK=cmd.exe /C copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt

我得到的输出是:

cmd.exe /C copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
The system cannot find the file specified.

有人吗知道这个问题的答案吗?

This question appears to be answered in this tread

qmake: How do I copy .dll/.so's to the output directory?

but it does not work for me. I'm trying to do this within Qt Creator 2.0.1 with Qt SDK 4.7.0 on Windows 7

If I try:

QMAKE_POST_LINK=copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt

on even a static file, the output I get is:

copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
process_begin: CreateProcess(NULL, copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt, ...) failed.
make (e=2): The system cannot find the file specified.

If I try:

QMAKE_POST_LINK=cmd.exe /C copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt

The output I get is:

cmd.exe /C copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
The system cannot find the file specified.

Does someone know the answer to this?

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

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

发布评论

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

评论(2

秉烛思 2024-10-15 09:15:08

正如错误消息所示,问题出在您要复制的文件的路径中。

我创建了一个简单的 .pro 文件,并使用相同的命令复制文件 - 路径相应更改 - 并且它工作正常。

QMAKE_POST_LINK=copy /Y .\hello.h .\debug\hello.h;

它相当于

QMAKE_POST_LINK=copy /Y hello.h debug\hello.h;

使用此命令将 .pro 文件同一目录中的文件 hello.h 复制到调试文件夹。

As the error message suggests the problem is in the path to the file you want to copy.

I created a simple .pro file and used the same command to copy a file - with the path changed accordingly - and it worked correctly.

QMAKE_POST_LINK=copy /Y .\hello.h .\debug\hello.h;

it's equivalent to

QMAKE_POST_LINK=copy /Y hello.h debug\hello.h;

With this command the file hello.h, in the same directory of the .pro file, is copied to the debug folder.

可爱暴击 2024-10-15 09:15:08

我得到了它!

显然,如果您从驱动器的根目录开始,则副本将不起作用。回去看看我的例子。我从当前驱动器的根源开始。我也试过了

QMAKE_POST_LINK=copy /Y $PWD\MyFile  $PWD\anotherdir\MyFile

也没用。

显然你必须相对于你的目录???我不确定真正的限制是什么。

I got it!

Apprently the copy does not work if you start at the root of your drive. Go back and look at my example. I was starting at the root of my current drive. I also tried

QMAKE_POST_LINK=copy /Y $PWD\MyFile  $PWD\anotherdir\MyFile

That did not work either.

Apprently you have to be relative to you directory???? I'm not sure what the real limitations are.

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