我正在尝试用C ++编写代码,我需要一个编译器。我得到了Sublime 3和MinGW-64并将MinGW-w64.sublime-build放入包中。当我按下ctrl + shift + b时,控制台会给我这个错误:
'g++' is not recognized as an internal or external command,
operable program or batch file.
'C:\Users\Rick\Desktop/test.exe' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.1s with exit code 1]
[cmd: ['g++', '-o', 'C:\\Users\\Rick\\Desktop/test.exe', '-static-libgcc', '-static-libstdc++', '*.cpp', '&', 'C:\\Users\\Rick\\Desktop/test.exe']]
[dir: C:\Users\Rick\Desktop]
[path: C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Skype\Phone\;C:\Users\Rick\AppData\Local\Microsoft\WindowsApps;]
这是我的代码:
#include <string>
#include <iostream>
using namespace std;
int main()
{
std::cout << "Hello World! " << std::end1;
return 0;
}
答案 0 :(得分:0)
将包含g ++。exe(.../bin
)的文件夹添加到PATH
。
您可以使用以下(Windows)命令执行此操作:
setx path "%path%;FOLDER_CONTAINING_G++"