Sublime Forum

A new build system

#1

Can you write a new build system that echoes its output to the output panel?
I want to use it for c-programs from cs50.

0 Likes

#2

Isn’t this the default behavior of the build system?

Why it needs a dedicated build system? Is cs50 a special case of C programming?

0 Likes

#3

I just want to link the correct library from the cs50 course from Harvard.
Error messages won’t show in Sublime.

It does now! Solved! Fixed the json file.

0 Likes

#4

Though it’s solved. I still post my solution here for adding a build variant (triggered by ctrl+shift+b from a selective panel) for linking custom libs. Welcome to suggest a more decent one which can make me use ST better :smile:

C.sublime-build:

{
    "cmd": [
        "gcc",
        "-std=c11",
        "-Wall",
        "${file}",
        "-I./include",
        "-o",
        "${file_path}/${file_base_name}",
    ],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c",
    "target": "console_exec",
    "variants": [{
        "name": "Run",
        "cmd": ["${file_path}/${file_base_name}"],
    }, {
        //////////////////////////
        // Harvard cs50 - Build //
        //////////////////////////
        "name": "Harvard cs50 - Build",
        "cmd": [
            "gcc",
            "-std=c11",
            "-Wall",
            "${file}",
            "-I./include",
            "-L/YOUR/LIB/DIR", // <---- add lib directory here
            "-o",
            "${file_path}/${file_base_name}",
        ],
    }],
}
2 Likes