libgvr.so链接最佳实践?

时间:2016-08-18 01:27:58

标签: android c++ android-ndk ndk-build google-vr

我将libgvr.so库包含在我的Android.mk中,将其包含在我的LOCAL_SRC_FILES中:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
        GVR_LIB_PATH :=  $(GVR_DIR)/ndk-beta/lib/android_arm
else
        ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
                GVR_LIB_PATH :=  $(GVR_DIR)/ndk-beta/lib/android_arm64
        else
                $(error Invalid architecture!)
        endif
endif
LOCAL_CPPFLAGS := -std=c++11 -Wall -Wextra
LOCAL_SRC_FILES := \
    foo.cpp \
    bar.cpp \
    $(GVR_LIB_PATH)/libgvr.so
LOCAL_C_INCLUDES := \
        include \
    generated \
        $(GVR_DIR)/ndk-beta/include/vr/gvr/capi/include \
        $(GVR_DIR)/ndk-beta/include
LOCAL_ALLOW_UNDEFINED_SYMBOLS := false

$ GVR_LIB_PATH在正确目录的起始路径中定义。但是,在编译和链接我的代码时,我为这里调用的函数提供了无法解析的符号:

Error:(1155) undefined reference to 'gvr_destroy'
Error:(1299) undefined reference to 'gvr_get_time_point_now'
Error:(1248) undefined reference to 'gvr_get_head_pose_in_start_space'

使用ndk-build链接libgvr.so的最佳方法是什么?如果这只是我遗漏的一个小命名错误,我会事先道歉。

1 个答案:

答案 0 :(得分:1)

我没有考虑到你正在尝试的不同架构,但这里最终为我工作的是:

Sub RepalaceStrong()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "<Strong"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
  Selection.Find.Execute
    Selection.Extend

    With Selection.Find
        .Text = "</Strong>"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
Selection.Find.Execute
Selection.Collapse Direction:=wdCollapseEnd
End Sub

include $(CLEAR_VARS) LOCAL_MODULE := libgvr LOCAL_SRC_FILES := $(GVR_ANDROID_BASE)/ndk-beta/lib/android_arm/libgvr.so include $(PREBUILT_SHARED_LIBRARY) LOCAL_SHARED_LIBRARIES += libgvr 指向从github克隆ZIP存档解压缩的目录。