17 Apr 2017

Build system for C programming in Sublime Text Mac OS X

1. Install Xcode or Xcode Command Line Tools(GCC).
2. Create a new build system:

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

3. Save it.
4. Press cmd+B for Buil and Run!

Tested on:
Mac OS X El Capitan
Sublime Text (Build 3126)

--------------------------

Where are compiler files?

Type in Terminal:

xcodebuild -find make
xcodebuild -find gcc
xcodebuild -find g++
xcodebuild -find clang
xcodebuild -find clang++

You can also install Xcode Command Line Tools which will place tools and libs under standard Unix locations (/usr/bin, /usr/include etc.) if you want to be able to just type make or gccwithout any paths.
 

No comments:

Post a Comment

Popular Posts