2012-07-31 132 views
2

我試圖編譯的Android 4.1爲我的設備,但我得到這個錯誤:C++錯誤,而編譯android源碼

target thumb C++: libandroid_runtime <= frameworks/base/core/jni/Time.cpp 
target thumb C++: libandroid_runtime <= frameworks/base/core/jni/com_android_internal_content_NativeLibraryHelper.cpp 
frameworks/base/core/jni/Time.cpp: In member function 'android::String8 android::Time::format(char const*, const android::strftime_locale*) const': 
frameworks/base/core/jni/Time.cpp:91:61: error: 'strftime_tz' was not declared in this scope 
make: *** [out/target/product/galaxysl/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/Time.o] Errore 1 
make: *** Attesa per i processi non terminati.... 

我該如何解決這些問題呢?我必須在Time.cpp中聲明strftime_tz,但我不知道要這樣做。有Time.cpp的一部分:

String8 
Time::format(const char *format, const struct strftime_locale *locale) const 
{ 
    char buf[257]; 
    int n = strftime_tz(buf, 257, format, &(this->t), locale); 
    if (n > 0) { 
     return String8(buf); 
    } else { 
     return String8(); 
    } 
} 

謝謝。

+0

好像'strftime_tz'是一個可擴展標準C函數'strftime'。我不認爲你應該聲明它,但是找出它已經被聲明的支持庫中的哪個地方。 – 2012-07-31 14:22:01

回答

0

好像你需要包括#include <cutils/tztime.h>

+0

可能與'#include ' – 2012-07-31 14:41:29

+0

一起已經有一個字符串,表示文件中的#include 。在這裏你可以看到整個文件: https://www.codeaurora.org/git/projects/qrd-gb-dsds-7225/repository/revisions/cc99b832a941dc8cbb86f1607d04eb87935ddbfd/entry/android/frameworks/base/core/jni/Time的.cpp – user1565567 2012-07-31 17:32:39