Skip to content

Instantly share code, notes, and snippets.

@matias-eduardo
Created October 20, 2016 06:21
Show Gist options
  • Select an option

  • Save matias-eduardo/8565c95d4fa8abb81fc2588a4cc8d86d to your computer and use it in GitHub Desktop.

Select an option

Save matias-eduardo/8565c95d4fa8abb81fc2588a4cc8d86d to your computer and use it in GitHub Desktop.
# Inspired by 21st Century C, 2nd Ed. <- go check it out!
# Purpose: Compile code from the terminal (stdin).
# Note: allheads.h simply includes all the basic sys h files.
# Careful: using the c2go alias runs then removes the a.out.
# How to use:
# $> go_c << '---'
# heredoc> int main() { printf("Hello from the terminal!\n"); }
# heredoc> ---
# $> c2go
# Hello from the terminal!
# $>
go_libs="-lm"
go_flags="-Wall -Wextra -Werror -include /nfs/2016/m/mfernand/sexyness/allheads.h -O3"
alias go_c="gcc -xc - $go_libs $go_flags"
alias c2go="./a.out; rm ./a.out"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment