编译项目时未定义的引用错误(ANDROID NDK)

时间:2014-10-04 17:10:11

标签: android c++ android-ndk java-native-interface

我正在使用Android NDK,我正面临着这个问题。我收到了以下错误;

22:30:09 **** Incremental Build of configuration Default for project MrBlueFramework ****
"D:\\Android_Development\\Android_NDK\\ndk-build.cmd" all 
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml    
[armeabi] Compile++ thumb: MrBlueFramework <= MrBlueFramework.cpp
[armeabi] SharedLibrary  : libMrBlueFramework.so
D:/Android_Development/Android_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/MrBlueFramework/MrBlueFramework.o: in function android_main:jni/MrBlueFramework.cpp:11: error: undefined reference to 'Framework::Application::Application(android_app*)'
D:/Android_Development/Android_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/MrBlueFramework/MrBlueFramework.o: in function android_main:jni/MrBlueFramework.cpp:11: error: undefined reference to 'Framework::Application::~Application()'
collect2: ld returned 1 exit status
make.exe: *** [obj/local/armeabi/libMrBlueFramework.so] Error 1

这是我的层次结构的样子;

enter image description here

这是我的android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := MrBlueFramework
LOCAL_SRC_FILES := MrBlueFramework.cpp \
                   Framework/Application/Application.cpp\
LOCAL_C_INCLUDES        := $(LOCAL_PATH)
LOCAL_LDLIBS    := -llog -landroid -lEGL -lGLESv2
LOCAL_STATIC_LIBRARIES := android_native_app_glue

include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)

以下是Application.h的内容

#include <android_native_app_glue.h>

namespace Framework
{
    class Application
    {
    private:

    public:
        Application(android_app *state);
        virtual ~Application();

        bool Initialize();
        void Run();

    };
}

这是主类(mrblueframework.cpp)

#include <jni.h>
#include <android_native_app_glue.h>
#include "Framework\Application\Application.h"

using namespace Framework;

void android_main(android_app *state)
{
    app_dummy();

    Application app(state);
}

我不明白我做错了什么,我将我的Application.h文件包含在最顶层,但仍然没有找到它。请帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

LOCAL_SRC_FILES := MrBlueFramework.cpp

Application.cpp不存在。