我已经安装了 Eclipse 和 CDT(在 eclipse 中使用 C/C++ 需要 CDT),还安装了 Cygwin 以便我可以编译我的文件。
在环境变量中,我将 Path 设置为包括以下内容:“C:\cygwin\bin;”
g++、make 和 GDC 都是通过 Cygwin 安装的。我通过在 bin 文件夹中搜索它们来确保这一点 - 它们都在那里。
如果我在 Windows 命令提示符中输入“make”,会出现:
make: *** No targets specified and no makefile found. Stop.
如果我在 Windows 命令提示符中输入“g++”或“gdc”,将出现(或类似的):
'g++' is not recognized as an internal or external command,
operable program or batch file.
所以,换句话说,make 正在工作,但其余部分不工作......但它们在同一个 bin 文件夹中!让我完全糊涂了。
如果我尝试打开 Cygwin Bash Shell,g++、make 和 GDC 都可以在那里工作。
但是,我需要它在命令提示符下工作,以便 Eclipse 能够编译我在 IDE 中编写的程序。
如果你知道为什么会这样,请告诉我。
最佳答案
我没有经常使用 cygwin,但我的理解是您已经从 cygwin bash shell 中使用它。
如果您需要 g++、make 等,请使用 mingw ,有了它,g++ 可以从普通的 Windows 命令行运行。
关于c++ - g++ 在 Windows 命令提示符下不工作。已安装 Cygwin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/637953/