通过Android NDK编译c ++文件时出错

时间:2015-03-23 22:58:01

标签: c android-ndk

我尝试编译一些库并得到错误:

In file included from *************************:
F:/include/strutils.h:40:37: error: expected ';', ',' or ')' before 'dest'
 extern void *mempcpy(void *restrict dest, const void *restrict src, size_t n);

这是strutils.h:

#ifndef HAVE_MEMPCPY
extern void *mempcpy(void *restrict dest, const void *restrict src, size_t n);
#endif

有什么不对?

1 个答案:

答案 0 :(得分:1)

它无法识别限制词。

如果是C文件,您可能需要指定一个命令行开关来告诉它识别C99关键字。 https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html

可替换地,

#define restrict

或者可能

#define restrict __restrict__

如果 .cpp 文件中包含 strutils.h C++ does not have standard support for restrict, but many compilers have equivalents which usually work in both C++ and C, such as the GNU Compiler Collection __restrict__