Eclipse CDT 创建的 makefile 无法“清理”在 Windows 上

发布于 2024-09-16 19:13:59 字数 259 浏览 1 评论 0原文

我有一个 makefile 项目,其中包含由 Eclipse CDT(Helios、MinGW)生成的 makefile。 “clean”命令不起作用,因为“del”命令是使用 ./src/myfile.o 等参数执行的,但在 Windows 上这不起作用(应该是 .\src\myfile.o)。

我怎样才能告诉 Eclipse 使用 Windows 路径分隔符或者用不同的东西替换命令“del”(我可以轻松编写一个批处理脚本,用反斜杠替换正斜杠)?

感谢您的任何提示!

I have a makefile project with makefiles generated by Eclipse CDT (Helios, MinGW). The "clean" command does not work because the "del" command is executed with arguments like ./src/myfile.o, but on Windows this doesn't work (should be .\src\myfile.o).

How can I either tell Eclipse to use the Windows Path Separator or otherwise maybe replace the command "del" by something different (I could easily write a batch script which replaces the forward-slashes by backslashes)?

Thanks for any hints!

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

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

发布评论

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

评论(5

简单 2024-09-23 19:13:59

有一个简单的解决方案,在项目的主目录中创建一个 makefile.defs 文件,其中包含以下内容:

RM := rm -rf

基本上,该文件允许您覆盖自动生成的 makefile 中的变量,并且 RM 是删除命令的包装。

There is simple solution, create a makefile.defs file in your project's main directory with the following content:

RM := rm -rf

Basically this file lets you override variables from auto-generated makefile and RM is wrapper for remove command.

瑶笙 2024-09-23 19:13:59

最好的选择是下载并安装 GnuUtils http://sourceforge.net/projects/gnuwin32/files/coreutils/5.3.0/coreutils-5.3.0.exe/download
并将安装的目录 (C:\ProgramFile???\GnuWin32\bin) 添加到您的 Windows 路径并重新启动 Eclipse。Eclipse 现在应该执行 rm-rf...如果仍然没有...重新启动 Windows 并再次检查您的路径查看它是否有 \GnuWin32\bin ...然后重新启动 eclipse...

The best option is to download and install GnuUtils http://sourceforge.net/projects/gnuwin32/files/coreutils/5.3.0/coreutils-5.3.0.exe/download
and add the installed directory (C:\ProgramFile???\GnuWin32\bin)to your windows path and restart eclipse.Eclipse should execute rm-rf now...if it still doesnt ...restart windows and check your path again to see if it has \GnuWin32\bin ...then restart eclipse...

失眠症患者 2024-09-23 19:13:59

在您的 msys bin 目录(我的计算机上为 C:\msys\1.0\bin)中创建 rm.exe 的副本并将其重命名为 del.exe。

这是一个黑客行为。我不熟悉 rm 和 del 参数之间的区别。基本功能就在那里。 (删除file1 file2 filen)

在windows中没有del.exe,删除功能内置于CMD.exe中。 eclipse 在没有 del 功能的 msys shell 中运行命令。这会阻止您添加 eclipse 的路径来搜索 del.exe。

我尝试了很多不同的方法来让托管 make 将“RM := rm”放入 makefile 中,但失败了。

in your msys bin directory (C:\msys\1.0\bin on my machine) create a copy of rm.exe and rename it del.exe.

this is a hack. i am not familiar with the differences between the rm and del arguments. the base functionality is there. (delete file1 file2 filen)

in windows there is no del.exe, the delete functionality is built into CMD.exe. eclipse runs the commands in the msys shell which does not have the del functionality. this prevents you from adding a path to eclipse in which to search for del.exe.

i tried many different things to get the managed make to put "RM := rm" in the makefile but failed.

过潦 2024-09-23 19:13:59

编辑 makefile 以使用 mingw rm 命令代替?

Edit the makefiles to use the mingw rm command instead?

栩栩如生 2024-09-23 19:13:59

在将 rm.exe 重命名为 del.exe 之前,请检查 Eclipse 中的路径。该路径必须具有 Unix 路径分隔符(正斜杠、/),而不是 Windows 路径分隔符(反斜杠、\)。
这解决了我这边的问题。

Before you rename rm.exe to del.exe, check the path in Eclipse. The path has to have Unix path separators (forward slash, /) and not the Windows path separator (backslash, \).
This has fixed the problem on my side.

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