我正在尝试编译一个依赖于很多东西的程序。
我使用并修改了提供的makefile来代表我的计算机设置,但是在编译的最后一步中,我不断得到很多 undefined reference 。

引起麻烦的命令行是:

gfortran -o ../cosmomc ParamNames.o Matrix_utils.o  settings.o IO.o cmbtypes.o Planck_like.o cmbdata.o WeakLen.o &
bbn.o lrggettheory.o mpk.o bao.o supernovae.o HST.o SDSSLy-a-v3.o CMB_Cls_simple.o paramdef.o propose.o params_CMB.o &
calclike.o EstCovmat.o PowellConstrainedMinimize.o minimize.o postprocess.o MCMC.o driver.o /home/darkside/tesis/CosmoMc &
/likelihood_v4p1/read_archive_map.o /home/darkside/tesis/CosmoMc/likelihood_v4p1/read_fits.o /home/darkside/tesis/CosmoMc/likelihood_v4p1/healpix_types.o /home/darkside/tesis &
/CosmoMc/likelihood_v4p1/WMAP_7yr_options.o /home/darkside/tesis/CosmoMc/likelihood_v4p1/WMAP_7yr_util.o /home/darkside/tesis &
/CosmoMc/likelihood_v4p1/WMAP_7yr_tt_pixlike.o /home/darkside/tesis/CosmoMc/likelihood_v4p1/WMAP_7yr_teeebb_pixlike.o /home/darkside/tesis/CosmoMc &
/likelihood_v4p1/WMAP_7yr_likelihood.o /home/darkside/tesis /CosmoMc/likelihood_v4p1/WMAP_7yr_gibbs.o /home/darkside/tesis &
/CosmoMc/likelihood_v4p1/WMAP_7yr_tt_beam_ptsrc_chisq.o /home/darkside/tesis/CosmoMc/likelihood_v4p1/br_mod_dist.o &

-L../camb -lcamb_cosmorec -lblas -llapack -L/usr/lib/gcc &
/i686-linux-gnu/4.4/ -lstdc++ -L../CosmoRec -lCosmoRec &
-L/usr/lib -lgsl -lgslcblas  -L/usr/lib/i386-linux/gnu/lib &
-L/home/darkside/tesis/CosmoMc/likelihood_v4p1 -lcfitsio &
-DMATRIX_SINGLE -O3 -fopenmp -ffree-form -x f95-cpp-input  &
-ffast-math -march=native -funroll-loops -DCOSMOREC -I../camb &
-I/usr/lib/i386-linux/gnu/include -I/home/darkside/tesis/CosmoMc/likelihood_v4p1

一些错误是:
../CosmoRec/libCosmoRec.a(CosmoRec.o): In function `__tcf_0':
 CosmoRec.cpp:(.text+0xb): undefined reference to `std::basic_string<char, std::char_traits<char>,
 std::allocator<char> >::~basic_string()'
 CosmoRec.cpp:(.text+0x17): undefined reference to `std::basic_string<char, std::char_traits<char>,
 std::allocator<char> >::~basic_string()'
 ../CosmoRec/libCosmoRec.a(CosmoRec.o): In function `__tcf_1':
 CosmoRec.cpp:(.text+0x47): undefined reference to `std::basic_string<char, std::char_traits<char>,
 std::allocator<char> >::~basic_string()'
 ../CosmoRec/libCosmoRec.a(CosmoRec.o): In function `std::_Vector_base<double, std::allocator<double>
  >::_M_deallocate(double*, unsigned int) [clone .isra.76]':

所有这些都在用g++编译的软件包中,所以我想问题可能出在lstdc++标志上。我试图将完整路径添加到库和其他选项,但是它不起作用。

任何帮助将不胜感激。

问候,
伊拉

最佳答案

您是否尝试过将-lstdc++放在链接命令的末尾?它需要遵循依赖于它的所有对象和库。

09-25 23:16