LOGD只能在native-lib.cpp才能打印出日志,而在其他.cpp文件中就會報錯: error: undefined reference to '__android_log_print'
還未解決
error:?undefined?reference?to?'__android_log_print'clang++:? error:?linker?command?failed?with?exit?code?1? (use?-v?to?see?invocation)ninja:?build?stopped:?subcommand?failed.
2020-12-06
可以新建一個 target_link_libraries 函數(shù),將log日志庫與你的其它.cpp編譯的動態(tài)庫鏈接。?
target_link_libraries 內(nèi)部也會受到排列順序的影響,將其它.cpp文件編譯的動態(tài)庫名字放在第一個,就可以正常打印log,但是有可能會導(dǎo)致其它庫出現(xiàn) undefined reference 錯誤。