android.mk 文件调用第三方静态库的示例

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/baidu_31872269/article/details/84554696
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS) 
LOCAL_MODULE := live555
LOCAL_SRC_FILES := liblive555.a
include $(PREBUILT_STATIC_LIBRARY) 

include $(CLEAR_VARS)    
LOCAL_MODULE    := stdc++
LOCAL_SRC_FILES := libstdc++.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS) 
LOCAL_C_INCLUDES += \
     $(LOCAL_PATH)/live/jni \
     $(LOCAL_PATH)/live/jni/BasicUsageEnvironment/include \
     $(LOCAL_PATH)/live/jni/liveMedia/include \
     $(LOCAL_PATH)/live/jni/groupsock/include \
     $(LOCAL_PATH)/live/jni/UsageEnvironment/include \

#LOCAL_SHARED_LIBRARIES := live555
LOCAL_STATIC_LIBRARIES := live555 stdc++

LOCAL_MODULE    := rtsplive555
LOCAL_SRC_FILES := \
	testRTSPClient.cpp
LOCAL_LDLIBS := -llog -lz

include $(BUILD_SHARED_LIBRARY)

在这里插入图片描述

展开阅读全文

静态库调用静态库

04-01

以下操作均在windows平台下;为3个工程,两个静态库工程static1和static2,static2调用static1;一个测试程序Test.rnrn1.static1工程,为静态库工程;rna.cpp如下:rn  #include "StdAfx.h"rn  #include"a.h"rn  int sub(int a,int b)rn  rn return a-b;rn  rnrna.h如下:rn  #ifndef URANUS_DENTRYrn  #define URANUS_DENTRYrn  extern "C"rn  rn int sub(int a,int b);rn  rn  #endifrnrnrnrn2.在static2工程中,并把a.h添加到该工程,a.lib拷贝到当前目录rnc.cpp如下:rn #include "StdAfx.h"rn #include "b.h"rn #include "a.h"rn #pragma comment(lib,"a.lib")rn int abcd(int a,int b)           [color=#FF0000]//static2调用static1[/color]rn rn return sub(a,b);rn rnc.h如下:rn #ifndef URANUS_DENTRYrn #define URANUS_DENTRYrn extern "C"rn rn int abcd(int a,int b);rn rn #endifrnrnrn3.在Test工程中,为控制台应用程序,并把b.h添加到该工程,b.lib拷贝到当前目录rnTest.cpp如下:rn #include "stdafx.h"rn #include "b.h"rn #pragma comment(lib,"b.lib")rnrn int main(int argc, char* argv[])rn rn //printf("Hello World!\n");rn printf("100-10=%d",abcd(100,10));rnrn return 0;rn rnrnrn[color=#FF0000]问题:[/color]rn1.但是在Test工程中中编译报错:rnLinking...rnTest.obj : error LNK2001: unresolved external symbol _abcdrnDebug/Test.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnTest.exe - 2 error(s), 0 warning(s)rnrn用Test工程只调用一个static1静态库没问题;而static2调用static1,Test工程再调用一个static2静态库就会报上述错误。rn2.rn静态库中有没有DLLMAIN函数,自己可以添加DLLMAIN函数吗rnrn^_^首次写静态库 新手 论坛

没有更多推荐了,返回首页