如何在Linux环境下编译lib 库
发布日期:2021-06-24 07:06:09 浏览次数:4 分类:技术文章

本文共 448 字,大约阅读时间需要 1 分钟。

export LD_LIBRARY_PATH=./

g++ -o libhell.so --share -fPIC hell.c hell.h    // 生成.lib文件

g++ -o hao -L. -lhell haowangli.c

/ 这个是 hell.h

#include <stdio.h>

void say();

/

/ 这个是 hell.c

#include <stdio.h>

#include "hell.h"

void say()

{

printf("hello world\n");

}

/

 

/ 这个是 haowangli.c

#include <stdio.h>

#include <iostream>

#include "hell.h"

using namespace std;

void say()

{

printf("hello world\n");

}

/

转载于:https://www.cnblogs.com/hualimengyu/p/3441858.html

转载地址:https://blog.csdn.net/weixin_30896763/article/details/99418591 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:KVC 字典转模型构造函数
下一篇:Codis集群的搭建与使用

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月07日 01时29分51秒