在最新版本的电报中出现此错误。
电报源代码版本:4.9.0
环境: ubuntu 17.10.0
android studio:3.2金丝雀9
ndk版本:14.1.3816874
[armeabi-v7a] Compile++ arm : tmessages.28 <= TgNetWrapper.cpp
/home/joker/telegram490/TMessagesProj/jni/./jni.c: In function
'listdir':
/home/joker/telegram490/TMessagesProj/jni/./jni.c:193:31: error:
'struct stat' has no member named 'st_atim'
if (attrib.st_atim.tv_sec != 0) {
^
/home/joker/telegram490/TMessagesProj/jni/./jni.c:194:35: error:
'struct stat' has no member named 'st_atim'
if (attrib.st_atim.tv_sec < time) {
^
/home/joker/telegram490/TMessagesProj/jni/./jni.c:198:35: error:
'struct stat' has no member named 'st_mtim'
if (attrib.st_mtim.tv_sec < time) {
^make: ***
[/home/joker/telegram490/TMessagesProj/build/intermediates
/ndkBuild/afat/
debug/obj/local/armeabi-v7a/objs-debug/tmessages.28/./jni.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from
/home/joker/telegram490/TMessagesProj/jni/./tgnet/TLObject.h:13:0,
from
/home/joker/telegram490/TMessagesProj/jni/./tgnet/ApiScheme.h:15,
from
/home/joker/telegram490/TMessagesProj/jni/./TgNetWrapper.cpp:2:
/home/joker/telegram490/TMessagesProj/jni/./tgnet/Defines.h: In
function 'std::string to_string_uint64(uint64_t)':
/home/joker/telegram490/TMessagesProj/jni/./tgnet/Defines.h:184:32:
error: expected ')' before 'PRIu64'
int len = sprintf(buf, "%" PRIu64, value);
编辑:
由于@ anubhav-gupta,我只能通过SDK Manager升级到r18-beta1版本。
升级后,我遇到此错误:
Android NDK: APP_STL gnustl_static is no longer supported. Please switch to either c++_static or c++_shared
编辑: 将NDK更新到r15并解决了问题。
答案 0 :(得分:2)
主要问题在这一行'struct stat' has no member named 'st_atim'
如果您使用的是NDK的现代版本,则将具有现代的struct stat:https://android.googlesource.com/platform/bionic/+/master/libc/include/sys/stat.h
请注意,您需要使用NDK的统一标头来获取最新标头。这是r15的默认设置,但选择加入r14。