我很难在OSX上使用英特尔编译器连接C ++和Fortran(10.9),我真的很感激一些帮助!
以前的相关问题主要谈论gfortran,特别是没有解决这个问题(链接C ++ / Fortran与英特尔编译器+ Mac OSX +主要在Fortran)。然后,我坚信这不是一个重复的问题。
主程序在Fortran中,由于内部原因,我无法将main传输到C ++。所以答案就像#34;用C ++写主要内容并链接Fortran库"没有帮助。
还有一条信息:C ++代码需要gsl-gnu scientific library和CERN Minuit2包
使用以下标志
编译C ++代码 icpc -c -O2 -std=c++11 -stdlib=libc++ -clangxx-name=clang++ -DHAVE_INLINE
其中-DHAVE_INLINE
是gsl进行优化所需的标志
Fortran代码的链接标志如下
F90CRLINK = -cxxlib -lgsl -lgslcblas -lm -lMinuit2
,编译器/链接器是ifort。
链接过程中的错误消息,如果有人需要弄明白我可以发布,表明ifort
无法找到C ++库。
更新1:错误消息
架构x86_64的未定义符号: " __ ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv",引自: min.o中的_minimizer __ZNSt3__16vectorIdNS_9allocatorIdEEEC1ERKS3_ in min.o __ZNK4ROOT7Minuit220BasicFunctionMinimum14UserParametersEv in min.o __ZNSt3__16vectorIN4ROOT7Minuit215MinuitParameterENS_9allocatorIS3_EEE6assignIPS3_EENS_9enable_ifIXsr3std3__121__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_ in min.o __ZNSt3__16vectorIjNS_9allocatorIjEEE6assignIPjEENS_9enable_ifIXsr3std3__121__is_forward_iteratorIT_EE5valueEvE4typeES7_S7_ in min.o __ZNSt3__16vectorIdNS_9allocatorIdEEE6assignIPdEENS_9enable_ifIXsr3std3__121__is_forward_iteratorIT_EE5valueEvE4typeES7_S7_ in min.o " __ ZNKSt3__16locale9use_facetERNS0_2idE",引自: min.o中的_minimizer 最小的__ZNK11MinFcnCosmoclERKNSt3__16vectorIdNS0_9allocatorIdEEEE __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o __ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_ in min.o " __ ZNKSt3__18ios_base6getlocEv",引自: min.o中的_minimizer 最小的__ZNK11MinFcnCosmoclERKNSt3__16vectorIdNS0_9allocatorIdEEEE __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o __ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_ in min.o " __ ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEmc",引自: __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o " __ ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5 _",引自: __ZNSt3__16vectorIN4ROOT7Minuit215MinuitParameterENS_9allocatorIS3_EEE6assignIPS3_EENS_9enable_ifIXsr3std3__121__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_ in min.o " __ ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev",引自: __ZNSt3__113__vector_baseIN4ROOT7Minuit215MinuitParameterENS_9allocatorIS3_EEED1Ev in min.o __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o min.o中__ZN4ROOT7Minuit216MnUserParametersD1Ev min.o中的__ZN4ROOT7Minuit220MnUserParameterStateD1Ev 在min.o中__ZN4ROOT7Minuit28MnMigradD1Ev __ZN4ROOT7Minuit219MnRefCountedPointerINS0_20BasicFunctionMinimumEE15RemoveReferenceEv in min.o __ZNK4ROOT7Minuit220BasicFunctionMinimum14UserParametersEv in min.o ... " __ ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5 _",引自: __ZNSt3__16vectorIN4ROOT7Minuit215MinuitParameterENS_9allocatorIS3_EEE6assignIPS3_EENS_9enable_ifIXsr3std3__121__is_forward_iteratorIT_EE5valueEvE4typeESA_SA_ in min.o " __ ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE3putEc",引自: min.o中的_minimizer 最小的__ZNK11MinFcnCosmoclERKNSt3__16vectorIdNS0_9allocatorIdEEEE __ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_ in min.o " __ ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5flushEv",引自: min.o中的_minimizer 最小的__ZNK11MinFcnCosmoclERKNSt3__16vectorIdNS0_9allocatorIdEEEE __ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_ in min.o " __ ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC1ERS3 _",引自: __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o " __ ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD1Ev",引自: __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o " __ ZNSt3__14coutE",引自: min.o中的_minimizer 最小的__ZNK11MinFcnCosmoclERKNSt3__16vectorIdNS0_9allocatorIdEEEE " __ ZNSt3__15ctypeIcE2idE",引自: min.o中的_minimizer 最小的__ZNK11MinFcnCosmoclERKNSt3__16vectorIdNS0_9allocatorIdEEEE __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o __ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_ in min.o " __ ZNSt3__16localeD1Ev",引自: min.o中的_minimizer 最小的__ZNK11MinFcnCosmoclERKNSt3__16vectorIdNS0_9allocatorIdEEEE __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o __ZNSt3__14endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_ in min.o " __ ZNSt3__18ios_base33__set_badbit_and_consider_rethrowEv",引自: __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o " __ ZNSt3__18ios_base5clearEj",引自: __ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc in min.o ld:找不到架构x86_64的符号