Linux离线安装libconfig
1. 下载libconfig
https://hyperrealm.github.io/libconfig/
2. linux下解压
tar -zvxf libconfig-1.7.3.tar.gz
3. linux下安装libconfig
1.进入libconfig-1.7.3文件夹
cd libconfig-1.7.2
2.输入以下命令进行安装
sudo ./configure
sudo make
sudo make check
sudo make install
4. 验证安装是否成功
#执行下面目录前,保证自己当前目录为:libconfig-1.7.3/
cd examples/c/
gcc example1.c -o example1 -lconfig
./example1
执行./example1命令的时候报错
./example1: error while loading shared libraries: libconfig.so.11: cannot open shared object file: No such file or directory
解决方案
sudo ldconfig -V
export LD_LIBRARY_PATH=/usr/local/lib
./example1 #重新编译
重新编译并运行,结果如下:
到此,Linux下的libconfig安装完毕!