简体   繁体   中英

How do I use MinGW-w64 with Sublime?

I am trying to code in C++ and I need a compiler. I got Sublime 3 and MinGW-64 and put MinGW-w64.sublime-build in packages. When I hit ctrl+shift+b the console gives me this error: '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;] '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;]

This is my code:

#include <string>
#include <iostream> 
using namespace std;    

    int main()      
    {    
        std::cout << "Hello World! " << std::end1;    
        return 0;      
    }

Add the folder containing g++.exe ( .../bin ) to your PATH .

You can do so with the following (Windows) command:

setx path "%path%;FOLDER_CONTAINING_G++"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM