在使用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)))
我想知道为什么会发生这种错误,因为我没有在源代码中使用任何section属性。
提前致谢!
答案 0 :(得分:0)
最后,我解决了这个问题。原因是我通过" -I"导入了错误的头文件。正确的应该在另一个文件夹中......