天天看點

NDK編譯cpp檔案出現的-Werror=format-security

原文出處

最近編譯的時候出現了列印日志時:

char * s = "cainiaobuhuifei";
LOGI(s);
           

報:error: format not a string literal and no format arguments [-Werror=format-security] 

從上面那個網站找到了解決方法為:

as of Android NDK revision 9, the following should be added to Android.mk as a work-around for the quoted error.

"LOCAL_DISABLE_FORMAT_STRING_CHECKS := true"

然後就好了,感謝國外大神。

繼續閱讀