Cygwin GCC + WinXP cmd.exe 不执行任何操作

发布于 2024-09-04 21:16:47 字数 222 浏览 5 评论 0原文

我的基本问题是,如果我从 Windows 命令行(Windows XP 中的 cmd.exe)运行 GCC,它什么也不做:没有创建 .o 文件,没有错误消息,什么也没有。如果我使用 DOS 风格的路径,它只会抛出一条错误消息,但不会抛出任何其他消息。当我从 Cygwin shell 运行时,它将根据源中的错误抛出相应的错误消息,并根据需要生成 .o 文件。从 DOS 命令行使用“make”也不起作用。以前有人遇到过这种行为吗?

My basic problem is that if I run GCC from the windows command line (cmd.exe in Windows XP) and it does nothing: no .o files are created, no error messages, nothing. It will only throw an error message if I use DOS-style paths, but nothing else. When I run from the Cygwin shell then it will throws error messages as appropriate for the errors in the source and produces the .o files as it needs. Using 'make' from the DOS command line doesn't work either. Has anyone encountered this behavior before?

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

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

发布评论

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

评论(2

ι不睡觉的鱼゛ 2024-09-11 21:16:47

我实际上已经在这方面取得了一些进展。背景:

我已经安装了 WinAVR,并且在我的 PATH 中设置了它的 bin 目录。 WinAVR 是 GCC 和相关的开发实用程序,但适用于 AVR 8 位微控制器。它与常规 GCC 共享许多实用程序名称。

过去我记得 Cygwin 将其 bin 目录放在 PATH 中。这次似乎没有这样做,所以我将“C:\cygwin\bin”放入 PATH,然后将“C:\cygwin\usr\bin”也放入其中。

最新版本的 Cygwin 在处理文件的方式上存在问题。基本上,gcc.exe 不是可执行文件,而是实际可执行文件的一种符号链接(可以是 gcc-3.exe 或 gcc-4.exe,具体取决于您安装的内容)。在 BASH shell 中,这些符号链接很容易解析,但在 cmd.exe 中则不然。这意味着,如果您尝试在 cmd.exe 中输入“gcc”作为命令,它将响应“访问被拒绝”。解决方案是调用实际的 GCC 文件名 (gcc-4) 而不是符号链接。

解决方案似乎是通过重新安排我的路径来实现的。要编辑 PATH 环境变量,请右键单击“我的电脑”并转到属性,然后转到高级,然后转到环境变量。在“系统变量”下找到“路径”并双击进行编辑。删除其中包含 C:\cygwin 的所有条目,然后转到 PATH 的前面并在其中输入它们。对我来说是 C:\cygwin\bin 和 C:\cygwin\usr\bin。对我来说重要的部分是确保 Cygwin 条目位于 WinAVR 条目之前。我注意到,当我尝试在 cmd.exe 中调用“make”时,它调用的是 WinAVR 版本而不是 Cygwin 版本。这导致我重新安排我的路径,经过一番闲逛后,很明显使用 cmd.exe shell 中的 gcc-4 是有效的。然后它也可以在 Code::Blocks 中运行,然后我就离开了。

或者,它可能刚刚完全修复了其他问题。计算机有办法做到这一点。

I've actually made some progress on this. Background:

I have WinAVR installed and its bin directories set in my PATH. WinAVR is GCC and associated development utilities but for the AVR 8-bit microcontroller. It shares many utility names with regular GCC.

In the past I remember Cygwin putting its bin directories in the PATH. It didn't seem to do this this time, so I put 'C:\cygwin\bin' into the PATH and then later 'C:\cygwin\usr\bin' there as well.

The latest release of Cygwin has issues with the way it handles files. Basically, gcc.exe is not an executable, but a type of symlink to the actual executable (which is either gcc-3.exe or gcc-4.exe depending on what you have installed). In the BASH shell these symlinks are easily resolved, in cmd.exe they are not. This means that if you attempt to enter 'gcc' into cmd.exe as a command it will respond 'Access is denied'. The solution for that is to call the actual GCC file name (gcc-4) instead of the symlink.

The solution seems to have come by rearranging my PATH. To edit the PATH environment variable, right click on 'My Computer' and go to properties, then Advanced and then Environment Variables. Under 'System Variables' find 'Path' and double click it to edit. Remove all entries that have C:\cygwin in them and then go to the FRONT of the PATH and enter them there. For me it was C:\cygwin\bin and C:\cygwin\usr\bin. The important part for me was making sure that the Cygwin entries were before the WinAVR entries. I noticed that when I tried to call 'make' in cmd.exe it was calling the WinAVR version instead of the Cygwin version. This lead me to rearrange my path and after some fooling around it became clear that using gcc-4 from the cmd.exe shell was working. It then worked in Code::Blocks as well and I was off.

Alternatively, it might have just fixed itself from something else entirely. Computers have a way of doing that.

我很OK 2024-09-11 21:16:47

或者,您可以删除文件:gcc.exe,这是一个文件链接并重命名
实际的 gcc 可执行文件: gcc-3.exe (或 gcc-4.exe 取决于您的版本)到 gcc.exe

Alternatively you can delete file: gcc.exe which is a file link and rename
the actual gcc executable file: gcc-3.exe (or gcc-4.exe depends on your version) to gcc.exe

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