在使用clang编译代码时,我遇到了一个非常奇怪的错误。
这是我的命令
$clang -c -emit-llvm -I/OP-TEE/op-tee-os/optee_os/lib/libutee/include/ -I/OP-TEE/op-tee-os/optee_os/lib/libutils/ext/include/ test_function_call_ta.c这是一个错误:
In file included from /usr/include/stdlib.h:314:
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:270:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:200:5: error: 'section' attribute only applies to functions, methods,
properties, and global variables
} __data;
^
/opensource_projects/OP-TEE/op-tee-os/optee_os/lib/libutils/ext/include/compiler.h:51:17: note: expanded
from macro '__data'
#define __data __section(".data")
^
/opensource_projects/OP-TEE/op-tee-os/optee_os/lib/libutils/ext/include/compiler.h:50:37: note: expanded
from macro '__section'
#define __section(x) __attribute__((section(x)))我想知道为什么会发生这个错误,因为我没有在源代码中使用任何节属性。
提前感谢!
发布于 2017-09-08 00:39:50
最后,我解决了这个问题。原因是我通过"-I“导入了一个错误的头文件。正确的一个应该放在另一个文件夹里..。
https://stackoverflow.com/questions/46105153
复制相似问题