浏览次数:3036 关键词 ( 案例 程序包 centos install )
1、ws.h 【头文件,声明函数名,未实现】 2、wso.c【包含函数体,实现函数,需要编译成动态链接库】 3、ws.h 【主程序执行文件】
toucu makefile 建立makefile文件 vi makefile 编辑makefile,
newws:ws.c libme.so gcc -L ./ -l me ws.c -o newws libme.so:ws.c gcc -shared wso.c -o libme.so install: cp ./libme.so /lib64 ldconfig
命令解析: 1、 makefile格式 最终生成的文件 newws 依赖于 shenyi.c libme.so 2、gcc生成编译文件命令 -L ./ 当前目录 -l mewso.c 生成最终newws 3、 libme.so 依赖于 ws.c 4、生成编译文件.so的命令(ws.c变成成libme.so) 5、make install 安装
5.1、将编译文件拷入核心库 5.2、更新缓存