0

I like Sublime a lot and wish to execute my program directly from the editor. I've done it with gcc, but now want to use tcc.

I can't find a build system for tcc so I took a C++ build system. There is a problem that it can't find the file I want to execute. Here's my build system:

{
    "shell_cmd": "tcc \"${file}\" -o \"${file_path}/${file_base_name}\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c",

    "variants":
    [
        {
            "name": "Run",
            "shell_cmd": "tcc \"${file}\" -run \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
        }
    ]
}

I changed g++ to tcc and -o to -run but it giving a file not found error.

tcc: error: file 'C:\Users\Paras Ghai\Documents\C Projects/Binary_Search' not found

Here after Documents\C Projects it is showing / in place of \. Is that the problem? How do I fix it?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Lovish Garg
  • 79
  • 2
  • 8
  • 1
    Your command: `"tcc \"${file}\" -run \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""` have a forward slash. Can't you change them to back slash?. (You might need to use an escape sequence to write \, but I believe `\\\` might work.) – Spade 000 Oct 27 '20 at 15:49
  • nope I tried but it gave me error and it can't be executed – Lovish Garg Oct 27 '20 at 15:51
  • Can you provide me the final code because I'm not good in these things – Lovish Garg Oct 27 '20 at 15:53
  • Try your command line in the shell. Only if you found the correct options, edit your editor's preferences accordingly. – the busybee Oct 27 '20 at 20:35

1 Answers1

0

So I did some changes and finally created a simple build-system for my tcc compiler and here it is->

{
"windows":
{
    "cmd": ["tcc","-std=c99" ,"-run", "$file_name"]
},
"selector" : "source.cpp",
"shell": true,
"working_dir" : "$file_path",
}

I hope that it works for other people too.

Lovish Garg
  • 79
  • 2
  • 8