错误:预期'=',',',',','ASM'或'诠释'前'__attribute__' [英] error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
问题描述
在编译时可以在LINUX C程序,我得到的FOLL。错误:
While compiling a C program in LINUX, I get the foll. error:
stream.h:1123: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
stream.h:1124: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'mblk_t'
stream.h:1125: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'mblk_t'
1123,1124线和1125如下:
Line 1123,1124 and 1125 are given below:
__STREAMS_EXTERN int adjmsg(mblk_t *mp, register ssize_t length);
__STREAMS_EXTERN mblk_t *allocb(size_t size, unsigned int priority);
__STREAMS_EXTERN mblk_t *copyb(register mblk_t *mp);
C程序包含的头文件又包括stream.h
任何想法,这可怎么解决?
The C program includes a header file which in turn includes stream.h Any idea how this can be solved?
推荐答案
这不是真的清除code的范围内,但在我看来,您使用OpenSSL库(或你正在做的复制和放大器;从源头code粘贴)
It's not really clear the context of your code but it seems to me that you're using the OpenSSL library (or you're doing copy & paste from that source code).
的 streams_fastcall
宏在 kmem.h
头文件中定义。你有吗?如果你只是在做复制和放大器;粘贴您只需你的 STREAMS_EXTERN
定义之前添加此行:
The streams_fastcall
macro is defined in the kmem.h
header file. Did you include it? If you're just doing copy & paste you simply have to add this lines before your STREAMS_EXTERN
definition:
#ifndef streams_fastcall
#if defined __i386__ || defined __x86_64__ || defined __k8__
#define streams_fastcall __attribute__((__regparm__(3)))
#else
#define streams_fastcall
#endif
#endif
注意: streams_fastcall
的声音的像微软特有的(但在Windows上广泛使用)调用约定名为 __ FASTCALL
。我猜是因为它使用了他们使用该名称
在 regparm
属性来指定一些参数应该传递使用,而不是堆栈寄存器,这就是 __ FASTCALL
定义(或者仅仅是因为它只是更快!笑)
Note: streams_fastcall
sounds like the Microsoft Specific (but widely used on Windows) calling convention named __fastcall
. I guess they used that name because it uses
the regparm
attribute to specify that some arguments should be passed using registers instead of the stack and this is what __fastcall
defines (or simply because it's simply faster! lol)
这篇关于错误:预期'=',',',',','ASM'或'诠释'前'__attribute__'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!