G++ is not recognized as an internal or external command, operable program or batch file sublime

c++sublimetext2

I must have gone through every other similar question on stack overflow as well as other tutorials trying to get sublime text 2 to run my cpp code but I have yet to get it to work.

My latest effort is using this guide here:
http://www.ishaanrawat.com/building-running-c-in-sublime-text-windows/

But it still will not work. The error I get is:

'g++' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.1s with exit code 1] [shell_cmd: g++ "C:\MinGW\bin\cards.cpp" -o "C:\MinGW\bin/cards"] [dir: C:\MinGW\bin] [path: C:\MinGW\bin\]

Please can someone guide me through this. In my bin folder, the exe is called mingw-get.exe if that helps. I created an enviroment varialbe as the guide said named MinGW with value of C:/MinGW/bin

my sublime text is not working what should i do after type hello world code and use command ctrl + B then (‘g++’ is not recognized as an internal or external command, operable program or batch file. [Finished in 0.1s]) it shows as output .

what should i do

hello @parasjain7086

follow these steps-> https://blog.codingblocks.com/2016/setting-up-sublime-text-for-competitive-coding/

G++ is not recognized as an internal or external command, operable program or batch file sublime
parasjain7086:

(‘g++’ is not recognized as an internal or external command, operable program or batch file. [Finished in 0.1s]) it shows as output .

what should i do

install g++ in ur system and add it in your environment variable

ok but this is for mac book users and i am using windows 10 so what should i do to resolve the problem

G++ is not recognized as an internal or external command, operable program or batch file sublime
parasjain7086:

ok but this is for mac book users and i am using windows 10 so what should i do to resolve the problem

installation procedure is same,apart from that u need to install g++ in ur system and add its path to environment variable.search it on internet how to do it for windows

sir i am unable to complete

refer this->link

for g++ installation

may yu please take anydesk and do it please

bro i m here to help u with ds algo doubts.

for any system specific doubt/issue pls take help of google stackoverflow or youtube

I hope I’ve cleared your doubt. I ask you to please rate your experience here Your feedback is very important. It helps us improve our platform and hence provide you

the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

I am trying to set up Sublime Text 3 so I am able to build and run c++ files. I have installed MinGW, and added C:\MinGW\bin\g++.exe to my system path, but I am still receiving this error after restarted Sublime Text 3. Here is the full error message

'g++' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.0s with exit code 1] [shell_cmd: g++ "C:\Users\Austin\Documents\Scripts\test.cpp" -o "C:\Users\Austin\Documents\Scripts/test"] [dir: C:\Users\Austin\Documents\Scripts] [path: C:\Program Files (x86)\Common Files\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)\Windows Live\Shared;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Hewlett-Packard\SimplePass\;C:\Program Files\Git\cmd;C:\Users\Austin\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\Austin\AppData\Local\Programs\Python\Python37;C:\Program Files\Java\jdk1.8.0_221\bin;C:\Program Files\Java\jdk1.8.0_221\jre\bin;C:\MinGW\bin\g++.exe]

4

THIS POST MAY BE IGNORED. RESTATING SUBLIME SOLVED IT

Hi,

I’m having problems when I try to compile programs in c++. I currently have this build file, which I stole of the internet somewhere, and it worked just fine.

{ "cmd": ["g++", "$file", "-o", "$file_base_name"], "selector": "source.c++", "working_dir": "$file_path", "variants": [ { "name": "Run", "cmd": ["g++", "$file", "-o", "$file_base_name", "&&", "$file_path/$file_base_name"], "shell": true } ] }

However, afterwards, I tried to install SDL onto my computer using the tutorial here
http://lazyfoo.net/SDL_tutorials/lesson01/windows/mingw/index.php

It didn’t work, so I deleted the related SDL files just in case, and also reverted the build file to what you see above.

However, now, when I run it, I get the following error:
g++' is not recognized as an internal or external command,operable program or batch file.

And before you say that it’s something to do with the path, I have properly configured it. (Again, this build has worked before). When I run g++ --version in the cmd prompt, I get the message:
g++ (GCC) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; se the source for copying conditions. There is NO warranty...
Which I think means that it has found the correct path.

As I have very little computing knowledge, may I ask that all steps be spelled out in painstaking detail?

Thank you very much.

1 Like

For me, it's easily fixed by two steps, as below:

  1. Set the environment variable:

    C:/MinGW/bin

  2. Paste the following code in the "launch.json":

{ "version": "0.2.0", "configurations": [ { "name": "C++ Compiler", "type": "cppvsdbg", "request": "launch", "program": "C:/MinGW/bin", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true }, ] }