我知道这已经被问了很多但是在大多数情况下答案都不是很令人满意/工作,所以我会尝试再给它一次:
在我的C ++项目中,由Eclipse CDT使用MinGW和GCC构建,我有以下构建前和构建后步骤:
到目前为止一切顺利,但问题在于:
当我快速重新编译应用程序时,删除和移动/覆盖步骤(前置和后置)失败并显示“权限被拒绝”消息。但是,一段时间后文件就消失了,所以我假设有一些删除命令在后台等待,直到授予权限为止。
这非常烦人,特别是因为我不能只做出改变,重新编译和测试。
我到目前为止找到的答案主要包括以下内容:
关于我可以检查哪些其他内容的任何想法?
顺便说一句,我在Win7机器上这样做,以防它确实重要。
更新
我尝试编译应用程序两次然后尝试删除命令行上的exe。 消息:权限被拒绝。
这是Process Monitor输出(命令为D:\Development\dist>del myapp.exe
):
23:46:16,6973545 cmd.exe 3716 QueryOpen D:\Development\dist\myapp.exe DELETE PENDING
23:46:16,6974731 cmd.exe 3716 QueryOpen D:\Development\dist\myapp.exe DELETE PENDING
23:46:16,6975989 cmd.exe 3716 CreateFile D:\Development\dist SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
23:46:16,6976533 cmd.exe 3716 QueryDirectory D:\Development\dist\myapp.exe SUCCESS Filter: myapp.exe, 1: myapp.exe
23:46:16,6977718 cmd.exe 3716 CreateFile D:\Development\dist\myapp.exe DELETE PENDING Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
23:46:16,6978960 cmd.exe 3716 CreateFile D:\Development\dist\myapp.exe DELETE PENDING Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
23:46:16,7655834 cmd.exe 3716 QueryDirectory D:\Development\dist NO MORE FILES
23:46:16,7656301 cmd.exe 3716 CloseFile D:\Development\dist SUCCESS
因此,似乎文件被阻止,因为删除处于待处理状态。我明天会检查预构建命令。