本人新手,在frameworks/base/services/jni添加了一个文件,test.cpp
文件代码如下:
#include <utils/Log.h>
//#include <jni.h>static int gtrdht(void){
LOGE("hello world!");
return 0;
}
在Android.mk里也添加了
LOCAL_SRC_FILES:= \
        ..\
        ..\
        test 
结果编译出来有出现很多错误,如下:
bionic/libc/include/signal.h:68: error: 'LONG_BIT' undeclared (first use in this function)
bionic/libc/include/signal.h: In function 'sigdelset':
bionic/libc/include/signal.h:77: error: 'LONG_BIT' undeclared (first use in this function)
bionic/libc/include/signal.h: At top level:
bionic/libc/include/signal.h:121: error: expected ')' before 'int'
In file included from system/core/include/cutils/log.h:34,
                 from hardware/telechips/common/modules/logo/logo.c:5:
bionic/libc/include/unistd.h:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fork'
bionic/libc/include/unistd.h:55: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'vfork'
bionic/libc/include/unistd.h:56: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getpid'
bionic/libc/include/unistd.h:57: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gettid'
bionic/libc/include/unistd.h:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getpgid'
bionic/libc/include/unistd.h:59: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:60: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getppid'
bionic/libc/include/unistd.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getpgrp'
bionic/libc/include/unistd.h:63: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'setsid'
bionic/libc/include/unistd.h:78: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:79: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getuid'
bionic/libc/include/unistd.h:80: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:81: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'geteuid'
bionic/libc/include/unistd.h:82: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:83: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getgid'
bionic/libc/include/unistd.h:84: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:85: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getegid'
bionic/libc/include/unistd.h:86: error: expected declaration specifiers or '...' before 'gid_t'
bionic/libc/include/unistd.h:87: warning: type defaults to 'int' in declaration of 'gid_t'
bionic/libc/include/unistd.h:87: error: expected ';', ',' or ')' before '*' token
bionic/libc/include/unistd.h:88: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:89: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:90: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:91: warning: parameter names (without types) in function declaration
bionic/libc/include/unistd.h:92: error: expected ')' before '*' token
bionic/libc/include/unistd.h:93: error: expected ')' before '*' token
bionic/libc/include/unistd.h:121: error: expected declaration specifiers or '...' before 'uid_t'
bionic/libc/include/unistd.h:121: error: expected declaration specifiers or '...' before 'gid_t'
bionic/libc/include/unistd.h:122: error: expected declaration specifiers or '...' before 'uid_t'
bionic/libc/include/unistd.h:122: error: expected declaration specifiers or '...' before 'gid_t'
bionic/libc/include/unistd.h:123: error: expected declaration specifiers or '...' before 'uid_t'
bionic/libc/include/unistd.h:123: error: expected declaration specifiers or '...' before 'gid_t'
bionic/libc/include/unistd.h:131: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'lseek64'
bionic/libc/include/unistd.h:186: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'tcgetpgrp'
bionic/libc/include/unistd.h:187: error: expected declaration specifiers or '...' before 'pid_t'
In file included from bionic/libc/include/pthread.h:33,
                 from system/core/include/cutils/log.h:36,
                 from hardware/telechips/common/modules/logo/logo.c:5:
bionic/libc/include/sched.h:45: error: expected ')' before 'int'
bionic/libc/include/sched.h:46: warning: parameter names (without types) in function declaration
bionic/libc/include/sched.h:50: error: expected ')' before 'const'
bionic/libc/include/sched.h:51: error: expected ')' before 'struct'
bionic/libc/include/sched.h:52: error: expected ')' before 'pid'怀疑是环境配置什么地方没配好。
只是简单的几行代码,困扰了挺久的,希望各路高手指点指点。