运行 C++ 代码时 vs 代码出现问题[已关闭]

问题描述 投票:0回答:1
g++ : The term 'g++' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling 
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:33
+ cd "d:\DSA course\" ; if ($?) { g++ StudentDBMS.cpp -o StudentDBMS }  ...
+                                 ~~~
    + CategoryInfo          : ObjectNotFound: (g++:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我试图用 C++ 运行我的程序,但失败了

c++ g++
1个回答
0
投票

因为您必须将 g++ 添加到您的 PATH 变量中。

首先查看你是否安装了g++,并找到它所在的位置。

如果您使用的是 Windows,它可能位于 C:\mingw 或 C:\Program Files\mingw。

然后打开系统属性 -> 高级 -> 环境变量。

然后在环境变量下选择 PATH 并单击编辑。

单击“新建”,然后单击“浏览”,找到 mingw 安装中的 bin 目录,并将其添加到路径中,然后就完成了。

重新启动IDE,它会自动找到g++。

© www.soinside.com 2019 - 2024. All rights reserved.