我在導(dǎo)入 string 的時(shí)候遇到問題
#include?<string>
這個(gè)會提示找不到 string
根據(jù) AS 自動提示就變成了
#include?"../../../../../../../Library/Android/sdk/ndk/20.0.5594570/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/string"
class?People?{
????std::string?getString();
};但還是找不到 string ,是需要配置 NDK 的環(huán)境變量嗎
2020-04-28
你把CMakeLists.txt 的 add_library 改成如上圖所示,就行了。不過你會發(fā)現(xiàn) nativate-lib.cpp 就報(bào)紅了
最好還是配置一下目錄,像我下邊這樣,所有的類都能正常引用了
aux_source_directory(.?SOURCE_FILES) aux_source_directory(pople?SOURCE_FILES_CORE) list(APPEND?SOURCE_FILES?${SOURCE_FILES_CORE}) add_library(?#?Sets?the?name?of?the?library. ????????native-lib ????????#?Sets?the?library?as?a?shared?library. ????????SHARED ????????#?Provides?a?relative?path?to?your?source?file(s). ????????${SOURCE_FILES})2020-04-12
我又來自己回答了,我忘記在 add_library 中添加 People.cpp ,也就是在 CMakeLists.txt 中添加
即可