c - 错误: expected primary-expression before "__attribute__"

标签 c gcc

如何避免以下错误:-

error: expected primary-expression before "__attribute__"

代码:

#define A(name) __attribute__(name)

如果我在代码中使用此宏作为 A(name),则会收到错误,因为 expected Primary-expression before "__attribute__"

最佳答案

尝试:

#define A(名称) __attribute__((名称))

由于没有代码,我无法判断您是否正确使用它。

关于c - 错误: expected primary-expression before "__attribute__",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7346761/

相关文章:

windows - 使通配符目标始终得到无所事事

sql - 为什么 SQL DISTINCT 不能与 ORDER BY CAST 一起使用?

c - 存储的数据与我可以在文件读取循环中访问的数据不同

在 C 中将 char 数组转换为整数数组

c++ - 为什么不编译

c++ - g++优化使程序无法运行

c++ - 保证唤醒所有线程并且每个线程只唤醒一次

c - 这段代码是如何编译的? (C 中的函数声明不正确)

c++ - 我可以使用我的部分数据作为锁吗?

c - 奇怪的 'asm'操作数有不可能的约束错误