C++ 在 Linux下编译动态链接库

来源:互联网 发布:linux touch.stmp 编辑:程序博客网 时间:2024/05/21 10:49

$g++ -fPIC -o test.o -c test.c
$g++ -shared -o test.so test.o

 

外部头文件需要添加-I参数

$g++ -Ipath -fPIC -o test.o -c test.c

c++编写的切勿用gcc来编译,否则在外部程序调用会出现问题

原创粉丝点击