2012-12-03 97 views
0

我定義我的Android.mk如下現有的各種方法:的Android NDK給未定義參考

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

LOCAL_C_INCLUDES += $(LOCAL_PATH) 
LOCAL_SRC_FILES := optplugin.c \ 
        optionobjclass.c \ 


LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog 
LOCAL_MODULE:= optplugin 
include $(BUILD_SHARED_LIBRARY) 

的optplugin.c文件拋出許多不確定參考了在optionobjclass.c

實現的方法

我將不勝感激任何形式的幫助。

在optplugin.c聲明:

#include <stdio.h> 
#include <string.h> 
#include <stdlib.h> 

//#include "pluginHelp.h" 
#include "npapi.h" 
#include "npruntime.h" 
//#include "npupp.h" 
#include "mcvdebug.h" 
//#include "jritypes.h" 
//#include "gogi_plugin_api.h"   /* GOGI Deprecated */ 
#include "optionobjclass.c" 
#include "optionsClass.h" 
#include "IOlsOptionObject.h" 
#include "npunix.c" 
#define TRACESYMBOL(...) extern int a; 
#define TraceDebug(m, ...) printf(__VA_ARGS__) 

#define TRUE 1 
#define FALSE 0 
+0

您是否在optplugin.c中包含了頭文件optionobjectclass.h?請從這兩個文件中添加一些代碼。 – Shaiful

+0

是的,頭文件都存在。 – harshalizee

+0

它是未定義的引用或函數的多重定義嗎? – Shaiful

回答

3

,因爲你正在編譯optionobjclass.c多次了多重定義錯誤發生。

LOCAL_SRC_FILES:= optplugin.c \

    optionobjclass.c \ 

的#include 「optionobjclass.c」

當你includ源文件時,源文件將被編譯。解決方案是從LOCAL_SRC_FILES刪除optionobjclass.c

但更好的方法是從optionobjclass.c製作heder文件optionobjectclass.h幷包含標題。

0

嘗試添加C PLUS PLUS標誌,如果存在任何C++代碼,則可能使用C++編譯器。

#ifdef __cplusplus 
extern "C" { 
#endif 


#ifdef __cplusplus 
} 
#endif