使用Cygwin、cmd和Sublime Text 2编译简单C程序时出错

使用Cygwin、cmd和Sublime Text 2编译简单C程序时出错,c,build,cmd,cygwin,sublimetext2,C,Build,Cmd,Cygwin,Sublimetext2,我在Windows7中安装了Cygwin。然后我将环境变量设置为路径“C:\cygwin\bin”,但当我尝试构建一个简单的“helloworld.C”文件时,它会显示以下内容: [Error 2] The system cannot find the file specified [cmd: [u'g++', u'C:\\programs\\helloworld.c', u'-o', u'C:\\programs/helloworld']] [dir: C:\programs] [path

我在Windows7中安装了Cygwin。然后我将环境变量设置为路径“C:\cygwin\bin”,但当我尝试构建一个简单的“helloworld.C”文件时,它会显示以下内容:

[Error 2] The system cannot find the file specified
[cmd:  [u'g++', u'C:\\programs\\helloworld.c', u'-o', u'C:\\programs/helloworld']]
[dir:  C:\programs]
[path: C:\cygwin\bin;C:\cygwin\bin;C:\cygwin\bin;C:\TC\BIN]
[Finished]
我写的代码如下:

#include <stdio.h>

main()
{
    printf("Hello, world\n");
}
#包括
main()
{
printf(“你好,世界”\n);
}

如何修复它?

安装所有的devel软件包,因为在不久的将来您将需要其中的一些

为此,请使用setup-x86.exe(或64位系统上的setup-x86_64.exe),因为这是通过Cygwin安装软件包的方式。如果您没有该可执行文件,请再次下载它(它是用于安装Cygwin的文件)


请记住使用正确的格式,因为在结尾的cmd行中,您编写了/helloworld而不是\helloword。

cygwin使用/cygdrive作为在文件名中指定驱动器的替代方法。。。例如:/cygdrive/c/programs/helloworld.c用于您的程序。或者,如果该文件位于cygwin安装树中,则可以将其相对于cygwin的安装位置指定为root。是否已安装gcc/g++?确定。。。我想我在安装过程中错过了选择软件包。。。。。现在有人能指导我如何卸载Cygwin吗?你不需要卸载它。。。只需重新运行最初运行的安装程序(setup-x86.exe或setup-x86_64.exe)。。。当您进入软件选择屏幕时,选择gcc。。。它们将被添加到你的安装中。谢谢你,伙计。。。照你说的做。。。将很快更新此帖子!