Sublime Forum

Help with build system for C-lang

#1

So I made a build system for C and this is what I got so far:

    {
        "cmd": "make $file_base_name && ./$file_base_name"],
        "file_regex": "^$file_name(.|\s)*",
        "selector": "source.c",
        "path": "/usr/bin:/usr/local/bin:$file_path",
        "shell": true
    }

What I want shown is:

  • Errors/warnings when there are any.
  • printf and other print statements when there are any. (Currently this is not shown)

When I build using my custom C.sublime-build, I only get output from the shell when there are errors/warnings. This is a result of my regex, ^$file_name(.|\s)*. If I comment out the file_regex line, the printf statements are shown but not the errors/warnings. The program output can, of course, be anything.

Sample error output:

    ex6.c: In function ‘int main(int, char**)’:
    ex6.c:19: warning: format ‘%s’ expects type ‘char*’, but argument 2 has type ‘int’
    ex6.c:19: warning: format ‘%c’ expects type ‘int’, but argument 3 has type ‘char*’
    ex6.c:19: warning: format ‘%s’ expects type ‘char*’, but argument 2 has type ‘int’
    ex6.c:19: warning: format ‘%c’ expects type ‘int’, but argument 3 has type ‘char*’
0 Likes