0
votes

I have set the system path properly and have tried doing this several times. But I keep getting the error that

g++ is not recognized as an internal or external command

The full error message is:

'g++' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.2s with exit code 1] [shell_cmd: g++ "C:\Users\NIGHTMARE\Documents\test.c" -o "C:\Users\NIGHTMARE\Documents/test" && "C:\Users\NIGHTMARE\Documents/test"] [dir: C:\Users\NIGHTMARE\Documents] [path: C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\mingw32;C:\Users\NIGHTMARE\AppData\Local\Microsoft\WindowsAppsC:\mingw32;]

What should I do to solve this problem?

1
Could you add the errors you are seeing to your question to help others answer your question? Thanksphuzi
yes sure , sir.rithvik36
Does the file C:\Mingw32\g++.exe exist, because I would assume that the path should contain C:\Mingw32\Bin instead or something similar.OdatNurd
I have changed the path still the same error occurs path is not being changes by sublimerithvik36

1 Answers

0
votes

I have met a similar problem when I tried to use pandoc to convert markdown to pdf files. The pandoc path has been properly set up: I can use pandoc command in system cmd.

I wrote a simple build system in sublime text to use pandoc to compile my file but similar error occurred. After consulting the sublime documentation, I have found that we can set a path variable in the custom build system:

path Optional.

PATH used by the cmd subprocess.

Use this option to add directories to PATH without having to modify your system’s settings.Environmental variables will be expanded.

The following is a working build system that works for me:

{
    "shell_cmd": "pandoc --pdf-engine=xelatex -f gfm --highlight-style zenburn -Vurlcolor=NavyBlue -V CJKmainfont=\"Source Han Serif SC\" \"${file}\" -o \"${file_path}/${file_base_name}.pdf\" ",
    "path": "C:/Users/east/AppData/Local/Pandoc/;%PATH%",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "text.html.markdown",

    "variants":
    [
        {
            "name": "Convert to PDF and Preview",
            "shell_cmd": "pandoc --pdf-engine=xelatex -f gfm --highlight-style zenburn -Vurlcolor=NavyBlue  -V CJKmainfont=\"Source Han Serif SC\" \"${file}\" -o \"${file_path}/${file_base_name}.pdf\"  &&SumatraPDF \"${file_path}/${file_base_name}.pdf\" ",
            "path": "C:/Users/east/AppData/Local/Pandoc/;%PATH%",
            // "shell_cmd":   "start \"$file_base_name\" call $file_base_name"
        }
    ]
}

You have to adapt it to your case, just change the path to directory where your g++ command resides which is followed by system path %PATH%.

After using above build system, I no longer met this problem. Let me know if it works for you.