0

I've allways used Code:Blocks for programing in C language, but last week I found out about Sublime Text and I loved it, I tried to compile a C program and, despite that I already tried all I could find to do it, I can't get my program to work, I get this message:

gcc: error: &&: No such file or directory

I already:
1. Checked and downloaded MinGW
2. Changed the path to the one where MinGW was instaled
3. Made a new build system Here is the build system a found and tried:

{    
"cmd" :["gcc", "$file_name", "-o", "${file_base_name}.exe", "&&", "${file_base_name}.exe"],    
"selector" : "source.c",    
"shell" : true,    
"working_dir" : "$file_path"    
}

Despite all of this, Sublime text can't compile, my guess is that there is something wrong in the configuration of Sublime Text, since when I try to compile it shows me the next:

WinError 2] El sistema no puede encontrar el archivo especificado
[cmd: ['gcc', 'punteros.c', '-o', 'punteros.exe', '&&', 'punteros.exe']]
[dir: C:\Users\ipeta\Documents\Termodinámica]
[path: C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\MATLAB\R2016a\runtime\win64;C:\Program Files\MATLAB\R2016a\bin;C:\Program Files\MATLAB\R2016a\polyspace\bin]
[Finished]

As you can see the path it shows is not the same I introduced in the system of my computer, wich was:

C:\MinGW\bin

I'd apreciate if someone could help me.
Pd. Sorry for my bad english, it isn't my natural language

  • Could you check if your %PATH% variable has been updated for C:/MinGW/bin after installation? The compilation log shows no MinGW/bin - so it just can't find a gcc.exe in any of the existing paths in %PATH%. – Fox Dec 02 '16 at 06:01
  • `gcc` is not a shell command, have you tried `"shell": false`? A shell command would be `echo` or `dir`. – idleberg Dec 02 '16 at 07:19

1 Answers1

0

Can you try this: Please remove ${file_base_name}.exe from yours.

{
 "shell_cmd" : "gcc $file_name -o ${file_base_name}",
 "working_dir" : "$file_path",
 "variants":
  [
   {
     "name": "Run",
     "shell_cmd": "gcc $file_name -o ${file_base_name} &&  ${file_path}/${file_base_name}"
   }
  ]
}
Habi Sheriff
  • 179
  • 1
  • 1
  • 7