1

我正在尝试编译一个依赖于很多东西的程序。我使用和修改提供的生成文件来代表我的计算机设置,但在编译的最后一步中我不断得到很多未定义的引用。

导致问题的命令行是:

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++ 标志。我尝试将完整路径添加到库和其他选项,但它不起作用。

任何帮助都会非常感激。

问候, 伊拉

4

1 回答 1

2

您是否尝试过将链接命令放在末尾-lstdc++?它需要任何依赖它的对象和库之后。

于 2012-10-12T11:41:52.720 回答