2014-04-11 71 views
0

下面的行GCC 4.9誤差上的#define

# define always_inline __attribute__((always_inline)) 

被包括(從另一個包含的文件),並與gcc 4.9抱怨:

inc/compiler.h:98:40: error: '__always_inline__' was not declared in this scope 
# define always_inline __attribute__((always_inline)) 
             ^

奇怪的是,相同的標頭(編譯器。 h)被包含在另一個編譯成功的源文件中。有任何想法嗎? 編輯:我只是確保always_inline未預定義。 FYI:

> g++ -v 
Using built-in specs. 
COLLECT_GCC=/opt/local/bin/g++-mp-4.9 
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin13/4.9.0/lto-wrapper 
Target: x86_64-apple-darwin13 
Configured with: /opt/local/var/macports/build/_opt_mports_dports_lang_gcc49/gcc49/work/gcc-4.9-20140406/configure --prefix=/opt/local --build=x86_64-apple-darwin13 --enable-languages=c,c++,objc,obj-c++,fortran,java --libdir=/opt/local/lib/gcc49 --includedir=/opt/local/include/gcc49 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.9 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.9 --with-gxx-include-dir=/opt/local/include/gcc49/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc49 4.9-20140406_0' 
Thread model: posix 
gcc version 4.9.0 20140406 (experimental) (MacPorts gcc49 4.9-20140406_0) 
+0

你在定義宏的行上得到了這個錯誤信息? –

+0

@凱瑟湯普森是的。 – Walter

+0

如果你編譯一個只包含那一行的'foo.c'文件,會發生什麼?是否有可能在該行上有一些有趣的人物?前一行的尾部反斜槓? –

回答

0

的編譯是說符號__always_inline__沒有定義,你所定義的符號always_inline。 我的compiler.h(arm \ atmel studio)的定義如下:#define __always_inline inline __attribute__((__always_inline__))