CMake无法确定目标程序的链接器语言:CydiaSubstrate…是我遇到的错误。我真的不明白我在做什么错,也找不到与通过cmake添加标题相关的任何东西。请参考以下代码:
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
platinmods
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/platinmods.cpp )
add_library( # Sets the name of the library.
CydiaSubstrate
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/CydiaSubstrate.h )
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
platinmods
# Links the target library to the log library
# included in the NDK.
${log-lib} )
target_link_libraries( # Specifies the target library.
CydiaSubstrate
# Links the target library to the log library
# included in the NDK.
${log-lib} )
答案 0 :(得分:0)
您可以尝试使用此链接,该链接在android-ndk示例中已关闭,或者在其他相关帖子中被Halim Qarroum
的{{3}}关闭了。
希望它可以为您提供帮助。
答案 1 :(得分:0)
您的代码正在尝试构建2个库:platinmods和CydiaSubstrate。但是,如果您的目的只是让platinmods.cpp使用CydiaSubstrate.h,则您的代码没有执行您想要的操作。确实猜到你想要以后,
#include "CydiaSubstrate.h"
,然后将CydiaSubstrate.h复制到platinmods.cpp所在的目录中。然后进行构建->清理,然后构建->生成apk以查看剩下的问题(并修复问题)。