您的位置:首页 > 运维架构 > Linux

如何在Linux环境下编译lib 库

2013-11-25 17:02 169 查看
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");

}

/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: