100分求解: g++编译输出.so连接.a文件出错
$g++ -fPIC calltest.cpp (编译calltest.cpp 得到 .o )
$g++ -shared -o libcalltest.so calltest.o -fPIC -I./ -L./ -ltest -ldl
(出错如下:)
/usr/bin/ld: .//libtest.a(test1.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
.//libtest.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
说明: libtest.a是有几个.o文件(如test1.o) ar得来的. 我写一个程序单独来call libtest.a,编译成可执行文件,编译通过,执行test也正常,编译命令如下.
g++ main.cpp -o test -fPIC -I./ -L./ -ltest -ldl
请各位大侠帮忙解答一下$g++ -shared -o libcalltest.so calltest.o -fPIC -I./ -L./ -ltest -ldl 出错原因
相关推荐
aarch64下的libjnetpcap.so文件
libjnetpcap.so,libjnetpcap-pcap100.so,arm64架构下的。全网首发哈。
使用c++编写和使用.so动态链接库
1,使用 c 生成动态链接库mylib.so的简单示例 声明文件mylib.h #ifndef __MY_LIB_H__ #define __MY_LIB_H__ void foobar(int i); #endif /* __MY_LIB_H__ */ 实现文件mylib.c #include <stdio> #include "mylib.h" void foobar(int i) { printf("Printing from myli
libmp3lame.so
libmp3lame.so 为armeabi-v7a架构的lame库,lame版本为3.100,用于mp3转码,其他的CPU架构so文件可联系我获取
详解PHP安装mysql.so扩展的方法
平常我们都是先安装mysql,然后才能去安装php。假如先安装php,后安装mysql,由于php需要连接mysql,因而在php引擎中需要配置使用mysql.so扩展。下面这篇文章主要介绍了PHP安装mysql.so扩展的方法,需要的朋友可以参考下
arcgis for android(armeabi armeabi-v7a) libruntimecore_java.so
arcgis for android(armeabi armeabi-v7a) libruntimecore_java.so


