C++ 涉及restrict关键字的编译器错误
可能重复:C++ 涉及restrict关键字的编译器错误,c++,restrict,restrict-qualifier,C++,Restrict,Restrict Qualifier,可能重复: 我正在尝试在OS X 10.8.2上安装,但遇到了很多类似这样的错误: bspline_base.h:95:17: error: expected ';' at end of declaration list void *restrict coefs; ^ ; 我不熟悉restrict关键字,但我觉得这可能是其他类型的问题,因为这是一个为其他人编译的流行代码 以下是该代码的完整上下文: typedef struct {
我正在尝试在OS X 10.8.2上安装,但遇到了很多类似这样的错误:
bspline_base.h:95:17: error: expected ';' at end of declaration list
void *restrict coefs;
^
;
我不熟悉restrict关键字,但我觉得这可能是其他类型的问题,因为这是一个为其他人编译的流行代码
以下是该代码的完整上下文:
typedef struct
{
spline_code sp_code;
type_code t_code;
void *restrict coefs;
} Bspline;
<>代码>限制<代码>不是标准C++中的关键字。代码将仅在支持
restrict
扩展名的编译器中编译
restrict
是C99中的一个关键字。因此,如果您使用C99编译器,它可以正常工作。restrict
仅在C模式下可用clang++
将需要\u restrict
-将-Drestrict=\u restrict
添加到编译器标志中。关于限制,请参阅。它不是C++语言的关键字(你加标签),正如第一个答案指出的。