0

I've defined my Android.mk as follow:

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) 

the optplugin.c files throws many undefined reference to methods that are implemented in optionobjclass.c

I would appreciate any kind of help.

The declaration in 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 
5
  • Did you include the header optionobjectclass.h in optplugin.c? Please add some code from both file. Commented Dec 3, 2012 at 5:17
  • Yes, the header files are all present. Commented Dec 3, 2012 at 5:43
  • Is it undefinied reference or multiple definition of functions? Commented Dec 3, 2012 at 5:58
  • Mostly undefined references. I do have a few multiple definition errors, too. Commented Dec 3, 2012 at 6:12
  • 1
    Please add your error log for undefined references. post my ans for multiple definitions error. Commented Dec 3, 2012 at 6:34

2 Answers 2

3

The multiple definition errors are occured because you are compiling optionobjclass.c multiple times.

LOCAL_SRC_FILES := optplugin.c \

 optionobjclass.c \ 

and

#include "optionobjclass.c"

When you includ a source file, the source file will be compiled. The solution is remove optionobjclass.c from LOCAL_SRC_FILES.

But the better way is to make heder file optionobjectclass.h from optionobjclass.c and include the header.

Sign up to request clarification or add additional context in comments.

Comments

0

try adding C PLUS PLUS flag, it might be using c++ compiler if any c++ code is present.

#ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.