Andes Workshop http://forum.andestech.com/ |
|
gcc -D變數 http://forum.andestech.com/viewtopic.php?f=25&t=679 |
Page 1 of 1 |
Author: | cindy [ Fri Mar 01, 2013 3:54 pm ] |
Post subject: | gcc -D變數 |
舉個例子: nds32le-elf-gcc -O3 -c -DUSR_ENTRY=0x80000 ...(後面不重要,省略) 類似於#define。 在main.c裡有一個 user_pc = (unsigned long)USR_ENTRY; 我們將這個變數的define寫在makefile裡。 下面是gcc對-D的說明。 -D name=definition The contents of definition are tokenized and processed as if they appeared during translation phase three in a ‘#define’ directive. In particular, the definition will be truncated by embedded newline characters. If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell’s quoting syntax to protect characters such as spaces that have a meaning in the shell syntax. If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign (if any). Parentheses are meaningful to most shells, so you will need to quote the option. With sh and csh, ‘-D’name(args...)=definition’’ works. ‘-D’ and ‘-U’ options are processed in the order they are given on the command line. All ‘-imacros file’ and ‘-include file’ options are processed after all ‘-D’ and ‘-U’ options. |
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |