2011-09-08 88 views
-3

如何避免以下错误: -错误:之前预期基本表达式 “__attribute__”

error: expected primary-expression before "__attribute__" 

代码:

#define A(name) __attribute__(name) 

如果我用我的代码,该宏为A(名称),我收到错误的expected primary-expression before "__attribute__"

+0

你会谈论html属性,或者是什么? – reporter

+0

for linker attributes – Akash

+0

发布更多代码。 –

回答

0

尝试:

#define A(name) __attribute__((name))

由于没有代码,我不能说你是否正确使用它。

+0

其mot工作。这是我的代码。 – Akash

+0

你做错了。 __attribute__为结构或函数提供了一个属性。例如,您可以使用'void my_func()__attribute __((noreturn))'。 'printf(“%s”,__attribute((noreturn)));''绝对*无*感。 – wormsparty

+0

如果你真的想在printf中打印,试试:'#define A(name)“__attribute __((”name“))”' – wormsparty

相关问题