美文网首页
NDK Makefile 找不到源文件,编译报错

NDK Makefile 找不到源文件,编译报错

作者: devzhaoyou | 来源:发表于2017-02-22 14:47 被阅读69次

    NDK中把源文件都添加到makefile中了结果编译时报以下错误

    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:504: error: undefined reference to 'h264_record::write_audio_data(short*, int, int)'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:475: error: undefined reference to 'h264_record::wirte_video_data(unsigned char*, int, unsigned int)'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:438: error: undefined reference to 'h264_record::h264_record()'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:443: error: undefined reference to 'h264_record::init(char const*)'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:451: error: undefined reference to 'h264_record::uninit()'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:452: error: undefined reference to 'h264_record::~h264_record()'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:438: error: undefined reference to 'h264_record::h264_record()'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:443: error: undefined reference to 'h264_record::init(char const*)'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:451: error: undefined reference to 'h264_record::uninit()'
    /Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/jni/../jni/../ECMedia/source/RecordLocal.cpp:452: error: undefined reference to 'h264_record::~h264_record()'
    collect2: error: ld returned 1 exit status
    make: *** [/Users/gezhaoyou/workspace/projects/yuntongxun/MyWebRtc_2.x/obj/local/armeabi/libECMedia.so] Error 1
    

    反复排查,makefile文件添加的正确,路径什么的都没有错,奇怪了。
    最终找到原因:android.mk 中指定了CPP的拓展名,原来是这样的:
    LOCAL_CPP_EXTENSION := .cc, 我新建的文件是以.cpp结尾的,把这句去掉,或者改成LOCAL_CPP_EXTENSION := .cc .cpp

    问题解决!

    相关文章

      网友评论

          本文标题:NDK Makefile 找不到源文件,编译报错

          本文链接:https://www.haomeiwen.com/subject/hvhmwttx.html