Код: Выделить всё
ld: error: undefined symbol: __android_log_print
>>> referenced by android_native_app_glue.c:51 (C:/dev/android/sdk/ndk/22.1.7171670/sources/android/native_app_glue\android_native_app_glue.c:51)
>>> CMakeFiles/app-glue.dir/C_/dev/android/sdk/ndk/22.1.7171670/sources/android/native_app_glue/android_native_app_glue.c.o:(android_app_read_cmd)
Код: Выделить всё
cmake_minimum_required(VERSION 3.22.1)
project(MyGame)
set (APP_GLUE_DIR ${ANDROID_NDK}/sources/android/native_app_glue)
add_library(app-glue SHARED ${APP_GLUE_DIR}/android_native_app_glue.c)
target_include_directories(app-glue PUBLIC ${APP_GLUE_DIR})
add_library(native-lib SHARED ./native-lib.cpp)
target_include_directories(native-lib PUBLIC ${APP_GLUE_DIR})
add_library(libMyGame SHARED IMPORTED )
find_library(log-lib log)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
target_link_libraries(native-lib app-glue android ${log-lib} libMyGame)
Подробнее здесь: https://stackoverflow.com/questions/791 ... -undefined