Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/126.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
无法为此项目未生成的目标指定链接库 我在教程中添加了C++在我的Android项目中的FixBase.我使用CMADE版本3.102 当我运行项目时,出现以下错误: Error configuring CMake server (C:\Users\User\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin). Check for working C compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe Check for working C compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Detecting C compile features Detecting C compile features - done Check for working CXX compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe Check for working CXX compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works Detecting CXX compiler ABI info Detecting CXX compiler ABI info - done Detecting CXX compile features Detecting CXX compile features - done Found PkgConfig: C:/ProgramData/chocolatey/bin/pkg-config.exe (found version "0.28") CMake Error at CMakeLists.txt:52 (target_link_libraries): Cannot specify link libraries for target "firebase_analytics;firebase_app" which is not built by this project. Configuring incomplete, errors occurred!_Android_C++_Firebase_Cmake - Fatal编程技术网

无法为此项目未生成的目标指定链接库 我在教程中添加了C++在我的Android项目中的FixBase.我使用CMADE版本3.102 当我运行项目时,出现以下错误: Error configuring CMake server (C:\Users\User\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin). Check for working C compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe Check for working C compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Detecting C compile features Detecting C compile features - done Check for working CXX compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe Check for working CXX compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works Detecting CXX compiler ABI info Detecting CXX compiler ABI info - done Detecting CXX compile features Detecting CXX compile features - done Found PkgConfig: C:/ProgramData/chocolatey/bin/pkg-config.exe (found version "0.28") CMake Error at CMakeLists.txt:52 (target_link_libraries): Cannot specify link libraries for target "firebase_analytics;firebase_app" which is not built by this project. Configuring incomplete, errors occurred!

无法为此项目未生成的目标指定链接库 我在教程中添加了C++在我的Android项目中的FixBase.我使用CMADE版本3.102 当我运行项目时,出现以下错误: Error configuring CMake server (C:\Users\User\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin). Check for working C compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe Check for working C compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Detecting C compile features Detecting C compile features - done Check for working CXX compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe Check for working CXX compiler: C:/Users/User/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works Detecting CXX compiler ABI info Detecting CXX compiler ABI info - done Detecting CXX compile features Detecting CXX compile features - done Found PkgConfig: C:/ProgramData/chocolatey/bin/pkg-config.exe (found version "0.28") CMake Error at CMakeLists.txt:52 (target_link_libraries): Cannot specify link libraries for target "firebase_analytics;firebase_app" which is not built by this project. Configuring incomplete, errors occurred!,android,c++,firebase,cmake,Android,C++,Firebase,Cmake,我的CMakeLists.txt文件: # 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_m

我的CMakeLists.txt文件:

# 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.
        native-lib

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        native-lib.cpp)

# 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.
        native-lib

        # Links the target library to the log library
        # included in the NDK.
        ${log-lib})
# Add Firebase libraries to the target using the function from the SDK.
add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL)


# The core Firebase library (firebase_app) is required to use any Firebase product,
# and it must always be listed last.
set(firebase_libs firebase_analytics firebase_app)
target_link_libraries(${target_name} "${firebase_libs}")

我注意到在这一行:

target_link_libraries(${target_name} "${firebase_libs}")
变量
target\u name
未定义,至少在您提供的CMake代码中未定义。您需要在此处替换您的目标的名称,而不是Firebase示例中使用的通用变量名称。请尝试以下方法:

target_link_libraries(native-lib "${firebase_libs}")

我注意到在这一行:

target_link_libraries(${target_name} "${firebase_libs}")
变量
target\u name
未定义,至少在您提供的CMake代码中未定义。您需要在此处替换您的目标的名称,而不是Firebase示例中使用的通用变量名称。请尝试以下方法:

target_link_libraries(native-lib "${firebase_libs}")

这也可能是因为没有首先列出您的库。例如,如果您有:

add_library( my_native_code
             SHARED

             # Other stuff here
             )

target_link_libraries(
    android)
这将在以下情况下失败:

Cannot specify link libraries for target "android" which is not built by this project.
您需要确保首先列出您的库:

target_link_libraries(
    my_native_code
    android)

这也可能是因为没有首先列出您的库。例如,如果您有:

add_library( my_native_code
             SHARED

             # Other stuff here
             )

target_link_libraries(
    android)
这将在以下情况下失败:

Cannot specify link libraries for target "android" which is not built by this project.
您需要确保首先列出您的库:

target_link_libraries(
    my_native_code
    android)