GNUstep 快捷键编译

时间:2024-07-31 00:08:07

$ gcc `gnustep-config --objc-flags` -L /GNU
orld.m -o helloworld -lgnustep-base -lobjc

$ ./helloworld.exe

快捷方式:

如果每次使用gcc的时候,都要输入这么长的命令,无疑是很恼火的事儿,我们可以做一个快捷方式:

编辑C:\GNUstep\bin\gcc.sh的文件,内容如下:

#!/bin/sh

if [ $# -ne 1 ]; then
echo "Usage: $0 name"
exit 1
fi

gcc -g -o $1 $1.m \
-fconstant-string-class=NSConstantString \
-I /GNUstep/System/Library/Headers/ \
-L /GNUstep/System/Library/Libraries/ \
-lobjc \
-lgnustep-base

exit 0

其中,gcc加入了-g参数,方便gdb调试,使用时就很方便了,注意别带扩展名m:

gcc.sh helloworld

$ ./helloworld.exe