如何避免以下錯誤: -錯誤:之前預期基本表達式 「__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
發佈更多代碼。 –