それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

Cygwinにビルド環境を作る

開発環境が、Cygwinデフォルト最小インストールに含まれません。選択して入れる必要があります。

開発環境

開発環境はDevelで提供されますが、SvnApacheまで巻き込む巨大パッケージなので、インストールは断念しました。

その代わり、必要最小限のものを入れていくことにしました。つまり以下の二つからです。

  • gcc-core
  • make

C++を使うなら

も必要です。

gcc-core ,make を入れる。

apt-cyg install gcc-core make 

コンパイルしてみる。

echo "#include<stdio.h>
int main(){
  printf(\"Hello World\n\");
}
" > test.c
gcc test.c

実行してみる

takuya@letsnote:~$ ./a.exe
Hello World

make がインストールできたかどうか

makefileの作成

echo -e  "# Makefile for hello.c
hello: test.c
\\tgcc  -o test.exe test.c
" > Makefile

make 実行

takuya@letsnote:~$ make
gcc  -o test.exe test.c
takuya@letsnote:~$ ./test.exe
Hello World
takuya@letsnote:~$

できあがり。あとは、NKFなど、生活必需品がコンパルできるようになります。