Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Studio包含cpp头文件_Android_Cmake_Android Ndk_Native_Header Files - Fatal编程技术网

Android Studio包含cpp头文件

Android Studio包含cpp头文件,android,cmake,android-ndk,native,header-files,Android,Cmake,Android Ndk,Native,Header Files,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 mini

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} )

您可以尝试使用这个已经在示例中关闭的链接,也可以在其他相关帖子中使用
Halim Qarroum


希望它能帮助您。

您的代码正在尝试构建两个库:platinmods和CydiaSubstrate。但是,如果您的意图只是让platinmods.cpp使用CydiaSubstrate.h,那么您的代码并不是在做您想要的事情。我猜你真的想晚一点

  • 在源代码中,包含“CydiaSubstrate.h”,并将CydiaSubstrate.h复制到与platinmods.cpp相同的目录中
  • 仅将platinmod相关代码保留在build.gradle中,删除所有CydiaSubstrate相关行
  • 如果您的头文件与源文件不在同一文件夹中,请使用CMake的()类似
  • 如果您正在使用源代码备份该头文件,则还需要将该源文件添加到compile中(与platinmods.cpp相同)
  • 打开CydiaSubstrate.h,看看需要定义什么宏才能使用它,这很有帮助

然后做一个Buff-> Cube,并构建->构建APK,看看问题是什么(并修复它们)。< /P> <代码> CydiasuButtual.H./C>你的头文件是正确的吗?是的,这是我的头文件,为什么不把它包含在C++文件中,使用<代码>包含< <代码> >?我的意思是不包括在Cmake文件Bro中,但是在<代码> PaltuMoDS.CPP< /Cord>我做了,但是它不能定位文件你的C++文件和头文件停留在同一条路径上还是不在Bro?