_CCFLAGS=" -w -enable-threads=posix -DLINUX -D_REENTRANT -DWORKONGN -Dlinux -D_GN_DETAIL_SDR_"
開始看不懂,鬧了半天就是個宏!!
下面附帶看過的參考資料:
gcc的-D和-U參數:宏的設置與取消 2006-10-08 22:59:06
分類: LINUX
這兩天做LFS注意到了gcc的-D參數:在gcc命令中定義宏,比如我有如下的代碼:
/* hello.c */
#include
#ifdef YES
char* str = "Yes, this is a macro.";
#else
char* str = "No, there is no macro.";
#endif
int main()
{
printf("%s\n", str);
return 0;
}
使用-D傳入宏YES來進行編譯:
recordus@LFS test # gcc -DYES -o helloyes hello.c
recordus@LFS test # ./helloyes
Yes, this is a macro.
而不傳入宏則是這樣的:
recordus@LFS test # gcc -o hellono hello.c
recordus@LFS test # ./hellono
No, there is no macro.
gcc還有與-D對應的另一個參數-U用於取消宏,比如:
root@LFS test # gcc -DYES -UYES -o helloyesno hello.c
root@LFS test # ./helloyesno
No, there is no macro.
這大概是這兩個參數最簡單的應用了:)