交叉编译1

交叉编译:
arm-linux-gcc包解压至/usr/local
gedit etc/profile,添加pathnum 路径 arm-linux-gcc
对源代码进行宿主机编译验证:gcc main.c -o main
file main
改变指令:arm-linux-gcc main.c -o main
建立源代码包和存放结果的文件夹,一般建立在usr下
hello.c
int main()
{
     mysay("hello");
}

helle.h
#ifdefine _hello_h
#defne _hello_h
#ifdefine _cplusplus
extern "C"
{
#endif
void mysay(const char *s);
#ifdefine _cplusplus
}
#endif

arm-linux-gcc hello.c -shared -o libhello.so /生产动态库文件
file lib.so

main.c
#include<hello.h>
int main()
{
 mysay("1");
}

arm-linux-gcc main.c -o main  -l/usr/arm/include -/usr/arm/lib -lsay ;链接动态库.so,
file main
arm-linux-readelf main -d(引用多少库,还可以-s,表示引用多少个符号)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值