简体   繁体   English

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

[英]Error during compile c++ file through Android NDK

I try to compile some library and get error: 我尝试编译一些库并得到错误:

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);

This is strutils.h : 这是strutils.h:

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

What wrong ? 怎么了

It does not recognize the word restrict. 它不识别限制一词。

If it is a C file, you probably need to specify a command-line switch to tell it recognize the C99 keywords. 如果它是C文件,则可能需要指定一个命令行开关来告诉它识别C99关键字。 https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html

Alternatively, 或者,

#define restrict

or probably 或可能

#define restrict __restrict__

if strutils.h is included from a .cpp file: 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__ 如果strutils.hcpp文件包括: C ++不具有标准的支持restrict ,但许多编译器有当量通常在C ++和C工作,如GNU编译器集__restrict__

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM