Skip to content

Instantly share code, notes, and snippets.

@koturn
Created May 18, 2013 20:29
Show Gist options
  • Save koturn/5605684 to your computer and use it in GitHub Desktop.
Save koturn/5605684 to your computer and use it in GitHub Desktop.
C言語のソースファイルを実行可能にした場合、コンパイル&実行できるように細工したもの。
#if 0
src=$0
exe=${src%.*}
gcc -s -O3 -pipe -Wall -Wextra -o $exe $src && $exe $@
exit
#endif
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
printf("Hello World!\n");
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment