我正在os161项目上工作。我创建一个文件,其中包含src/kern/include中的array.h提供。在编译时,我遇到了这样的错误:./include/array.h:85: error: expected '=',',‘';’','asm‘,'asm’或‘属性’之前的'unsigned‘././include/array.h:91:错误:预期’',‘’,‘';’‘,’,‘’或‘属性’之前'void‘之前的’属性‘
守则是这样的:
#ifndef ARRAYINLINE
#define ARRAYINLINE INLINE
#endif
ARRAYINLINE unsigned --------------line 85 error
array_num(const struct array *a)
{
return a->num;
}
ARRAYINLINE void * --------------line 91 error
array_get(const struct array *a, unsigned index)
{
ARRAYASSERT(index < a->num);
return a->v[index];
}这样的错误发生在每行都有类似的内联或ARRAYINLINE。这个array.h文件是提供的,我没有对它做任何更改。真搞不懂为什么。
发布于 2012-03-26 12:42:30
我也在研究os161。未定义INLINE,请尝试使用#define ARRAYINLINE inline。
编辑
我检查了我的os161修订版。我在#define ARRAYINLINE INLINE之前找到了这一行
#define INLINE extern inline因此,请检查您的array.h是否也包含这一行(在我的例子中是115)
/EDIT
发布于 2015-02-26 04:03:27
我也在处理OS161,如果函数之外有一个随机字符,就会产生这个错误。示例:
#include <...>
...
e //<-this random character that could have been mistyped.
sys_fork(...){
...
}https://stackoverflow.com/questions/9869378
复制相似问题