我正在尝试链接从Vienna RNA下载的库,以便可以在我的C代码中使用算法
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ViennaRNA/fold.h>
#include <ViennaRNA/mfe.h>
int main(){
/* The RNA sequence */
char *seq = "GAGUAGUGGAACCAGGCUAUGUUUGUGACUCGCAGACUAACA";
/* allocate memory for MFE structure (length + 1) */
char *structure;
/* predict Minmum Free Energy and corresponding secondary structure */
float mfe = vrna_fold(seq, structure);
/* print sequence, structure and MFE */
printf("%s\n%s [ %6.2f ]\n", seq, structure, mfe);
return 0;
}
gcc给了我
undefined reference to `vrna_fold'
这是vrna_fold vrna_fold的文档。 我遵循了Vienna RNA的配置 他们告诉我跑步:
pkg-config --cflags RNAlib2
pkg-config --libs RNAlib2
我去了
-I/usr/include
-lRNA -fopenmp -lgsl -lgslcblas
分别; 然后我跑了
gcc q5.c -I/usr/include -lRNA -fopenmp -lgsl -lgslcblas
得到
lto1: fatal error: bytecode stream generated with LTO version 4.1 instead of the expected 4.2
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status