简体   繁体   English

未定义对现有方法的引用

[英]Undefined reference to existing method

I am trying to compile CyanogenMod 10.2 for my device, but I get a compilation error while compiling frameworks/av: 我正在尝试为我的设备编译CyanogenMod 10.2,但是在编译frameworks / av时出现编译错误:

target SharedLib: libmediaplayerservice (/home/vektor/CM102/out/target/product/s7300b  /obj/SHARED_LIBRARIES/libmediaplayerservice_intermediates/LINKED/libmediaplayerservice.so)
frameworks/av/media/libmediaplayerservice/AmlogicPlayer.cpp:891: error: undefined reference to 'ammodule_match_check(char const*, char const*)'

That method is declared in ammodule.h contained in /device/my/device/packages/LibPlayer/amavutils/include 这种方法是在声明ammodule.h所含/device/my/device/packages/LibPlayer/amavutils/include

And in AmlogicPlayer.cpp it's included: AmlogicPlayer.cpp它包括:

#include "ammodule.h"

In Android.mk the file seems included: Android.mk该文件似乎包括在内:

AMPLAYER_APK_DIR=$(TOP)/device/my/device/packages/LibPlayer/
LOCAL_C_INCLUDES +=\
    $(AMPLAYER_APK_DIR)/amavutils/include     

This is the signature from ammodule.h 这是ammodule.h的签名

int ammodule_match_check(const char *allmodstr,const char *modname);

Everything seems ok. 一切似乎还好。 What could cause such errors? 什么会导致此类错误?

The function signiture refers to 功能签名指的是

const char *

Whereas the c++ file is looking for a function with 而C ++文件正在寻找具有

char const*

These are not the same thing. 这些不是一回事。 One is a constant pointer to a non-constant char, whereas the other is a non-constant pointer to a constant char. 一个是指向非恒定char的常量指针,而另一个是指向恒定char的非常量指针。 Google const char* vs char const* for more info. Google const char * vs char const *了解更多信息。

This problem is not caused by const char* and char const * because they are all the same. 此问题不是由const char*char const *引起的,因为它们都是相同的。 const char * and char * const are different things. const char *char * const是不同的东西。 Further more, if the signature mis-matches, the compiler, instead of the linker will complain. 此外,如果签名不匹配,编译器(而不是链接器)将抱怨。

I suggest that you check the LD_LIBRARY_PATH and the -l option in your Android.mk to see if the error disappears. 建议您在Android.mk中检查LD_LIBRARY_PATH和-l选项,以查看错误是否消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM