ubuntu version: 13.10 gcc, g++ version: 4.8.1 cppunit version: 1.12.1
cppunit 能够在该处下载cppunit传送门ubuntu
解压之后, 安装仍然是传统的三步骤:测试
configure
的过程可以很容易的经过, 当进行make的时候, 则出现了以下的错误:.net
g++ -g -O2 -o .libs/DllPlugInTester DllPlugInTester.o CommandLineParser.o -ldl ../../src/cppunit/.libs/libcppunit.so -lm ../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlsym' ../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlopen' ../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlclose' collect2: error: ld returned 1 exit status make[2]: *** [DllPlugInTester] Error 1 make[2]: Leaving directory `/home/xc-pc/software/cppunit-1.12.1/src/DllPlugInTester' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/xc-pc/software/cppunit-1.12.1/src' make: *** [all-recursive] Error 1
从上面的提示能够看出, 问题是出在DllPlugInTester编译的过程当中, 出现这个问题的可能缘由是g++的版本为4.8.1.code
cd到DllPlugInTester目录下,get
vi Makefile
在LDFLAGS=
后面加上, LDFLAGS=-Wl,--no-as-need
, 而后再次make
, 若是在其余的目录又出现相似的问题, 用一样的方法进行处理便可. 最后利用sudo make install
完成安装it
在具体使用的过程当中, 会出现找不到libcppunit.so.1**相似的错误, 缘由是没有将路径添加到环境变量, 能够经过如下步骤实现:io
vi /etc/ld.so.conf
添加一行/usr/local/lib
而后运行sudo ldconfig
便可export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH