官方文档上编译gtk+命令是:
- gcc filename.c `pkg-config --cflags --libs gtk+-3.0` -o filename
- ./filename
命令太长,为了方便编译运行,写了一个脚本 ~/bin/gcc/gcc.sh
- case $# in
- 0)
- echo "Usage:mygcc filename.c filename"
- ;;
- 2)
- gcc $PWD/$1 `pkg-config --cflags --libs gtk+-3.0` -o $PWD/$2
$PWD/$2
- ;;
- esac
为了方便调用在~/.bashrc 里添加alias
- echo "alias mygcc='/home/warren/bin/gcc/mygcc.sh'" > ~/.bashrc
- source ~/.bashrc
调试运行时:gcc filename.c filename
转载于:https://blog.51cto.com/wancheng/1052779