C++ “g++”不被识别为内部或外部命令,MinGW
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9741568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"g++" is not recognized as an internal or external command, MinGW
提问by user1274566
On my computer I have Windows 7 x86. I installed MinGW, I wrote the path but when I go in cmd.exe and write g++ -v it says:
在我的电脑上,我有 Windows 7 x86。我安装了 MinGW,我写了路径,但是当我进入 cmd.exe 并编写 g++ -v 时,它说:
"g++" is not recognized as an internal or external command.
But when I write the make -v command it recognizes it. I need this for school, I work in Eclipse, I even installed the latest java(I saw it must be installed).
但是当我编写 make -v 命令时,它会识别它。我在学校需要这个,我在 Eclipse 工作,我什至安装了最新的 java(我看到它必须安装)。
回答by MichaelvdNet
Seeing that the make command works fine, I think you forgot to mark the mingw-gcc-g++
package in the MinGW Installation Manager.
看到 make 命令运行正常,我认为您忘记mingw-gcc-g++
在 MinGW 安装管理器中标记该包。
Run the MinGW Installation Manager again and mark mingw-gcc-g++
for installation and press Apply Changes
再次运行 MinGW 安装管理器并标记mingw-gcc-g++
安装并按Apply Changes
回答by Vishwanath K R
You have to modify environment variables. Do the following:
您必须修改环境变量。请执行下列操作:
- From the desktop, right-click Computer and click Properties.
- From the Computer Properties window, click Change Settings
- In the System Properties window which opens up, click on the Advanced tab.
- In the Advanced section, click the Environment Variables button.
Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32
- 在桌面上,右键单击“计算机”,然后单击“属性”。
- 在“计算机属性”窗口中,单击“更改设置”
- 在打开的系统属性窗口中,单击高级选项卡。
- 在高级部分中,单击环境变量按钮。
最后,在 Environment Variables 窗口(如下所示)中,突出显示 Systems Variable 部分中的 Path 变量,然后单击 Edit 按钮。添加或修改带有您希望计算机访问的路径的路径行。每个不同的目录用分号分隔,如下所示。
C:\Program Files;C:\Winnt;C:\Winnt\System32
Additionally you may refer to this link
另外你可以参考这个链接
回答by yasser alaa eldin
I had the same problem in Sublime..
我在 Sublime 中遇到了同样的问题..
Right click on my computer
Advanced system settings
Environment variables
in system variables, change path to location of '...\MinGW\bin'
Example: D:\work\sublime\MinGW\bin
示例:D:\work\sublime\MinGW\bin