gfortran未定义的引用 [英] gfortran undefined references

查看:354
本文介绍了gfortran未定义的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to compile a program that depends on a lot of things. I use and modify the makefile provided to stand for my computer settings, but I keep getting a lot of undefined references in the last step of compilation.

引起麻烦的命令行是:

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

All of them are in the package compiled in g++, so I guess the problem can be the lstdc++ flag. I tried to add the complete path to the library and other options, but it doesn't work.

任何帮助都会非常感激.

Any help would be really aprecciated.

关于, 伊拉

推荐答案

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

Have you tried putting -lstdc++ at th end of the link command? It needs to come after any objects and libraries that depend on it.

这篇关于gfortran未定义的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆