如何避免以下错误: -错误:之前预期基本表达式 “__attribute__”
error: expected primary-expression before "__attribute__"
代码:
#define A(name) __attribute__(name)
如果我用我的代码,该宏为A(名称),我收到错误的expected primary-expression before "__attribute__"
如何避免以下错误: -错误:之前预期基本表达式 “__attribute__”
error: expected primary-expression before "__attribute__"
代码:
#define A(name) __attribute__(name)
如果我用我的代码,该宏为A(名称),我收到错误的expected primary-expression before "__attribute__"
尝试:
#define A(name) __attribute__((name))
由于没有代码,我不能说你是否正确使用它。
其mot工作。这是我的代码。 – Akash
你做错了。 __attribute__为结构或函数提供了一个属性。例如,您可以使用'void my_func()__attribute __((noreturn))'。 'printf(“%s”,__attribute((noreturn)));''绝对*无*感。 – wormsparty
如果你真的想在printf中打印,试试:'#define A(name)“__attribute __((”name“))”' – wormsparty
你会谈论html属性,或者是什么? – reporter
for linker attributes – Akash
发布更多代码。 –