Windows上的Eclipse CDT清理失败:尝试运行rm -rf

时间:2013-07-31 07:33:35

标签: windows eclipse eclipse-cdt

我在Windows 7上使用Juno和CDT。 当我尝试使用MinGW提供的内部构建器或make来清理项目时,Eclipse会运行* X命令     rm -rf 干净的操作失败了。

从控制台使用外部构建器(mingw32-make)进行日志记录:

18:08:07 **** Clean-only build of configuration Debug for project threads_example ****
mingw32-make clean 
rm -rf  ./main.o  ./main.d  threads_example
process_begin: CreateProcess(NULL, rm -rf ./main.o ./main.d threads_example, ...) failed.
make (e=2): The system cannot find the file specified.

mingw32-make: [clean] Error 2 (ignored)
' '

18:08:07 Build Finished (took 137ms)

使用内部构建器记录:

10:39:35 **** Clean-only build of configuration Debug for project threads_example ****
rm -rf threads_example main.o main.d 
Cannot run program "rm": Launching failed

Error: Program "rm" not found in PATH
PATH=[C:\CS_powerpc\bin;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java    /jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\siriusSDK\CS_i686\bin;c:\siriusSDK\CS_powerpc\bin;C:\siriusSDK\MinGW\msys\1.0\bin;C:\MinGW\bin;;C:\work\eclipse]


10:39:35 Build Finished (took 41ms)

10:39:35 **** Clean-only build of configuration Debug for project threads_example ****

10:39:35 Build Finished (took 46ms)

5 个答案:

答案 0 :(得分:4)

原来在.cproject文件中有一个属性xml控制clean命令。

查找配置标记,并将cleanCommand属性设置为您想要的属性。我已将其设置为rm -rf并使用gnuutils来支持Windows上的命令 您可以将命令更改为任何内容。

<configuration artifactExtension="so" artifactName="MyProject" ... cleanCommand="rm -rf" ...>

答案 1 :(得分:2)

最佳解决方案是安装 GnuUtils/coreutils 并将已安装的目录(C:\ ProgramFiles \ GnuWin32 \ bin)添加到Windows路径,然后重新启动eclipse。

Eclipse现在应该执行rm-rf ...

如果它仍然不起作用,只需重新启动Windows(在Windows memeory中设置路径)并再次检查您的路径以确保它具有\ GnuWin32 \ bin。终于开始了日食。

答案 2 :(得分:1)

我找到了一个解决方法,对我有用: 如果你查看托管make makefile,你可以找到一行&#34; RM:= ...&#34; 在该行之后有一行&#34; -include ../makefile.defs"在我的情况下不存在。

如果您创建此文件,则可以重新定义&#34; RM:= ...&#34;任何你想要的宏。

例如: RM:= del

在这种情况下,自动构建过程将使用您的定义删除文件和文件夹,而不是eclipse的预定义定义。

答案 3 :(得分:1)

我遇到此错误,因为我在项目 - &gt;属性 - &gt; C ++构建 - &gt;环境

下的 MSYS_HOME 中输入了拼写错误

答案 4 :(得分:0)

一个简单的解决方案是安装Git for Windows并在安装选项中为cmd.exe启用类似Unix的命令。然后将支持rm -rf