gpt4 book ai didi

c - "ERROR:Undefined symbols for architecture x86_64"在 LibSBMLSim(SBML=Systems Biology Markup Language)中出现

转载 作者:太空宇宙 更新时间:2023-11-04 03:20:50 25 4
gpt4 key购买 nike

我尝试在 C 语言中使用 LibSBMLSim 作为 api。我引用了 https://fun.bio.keio.ac.jp/software/libsbmlsim/并安装了 LibSBML 和 LibSBMLSim。然后我制作了如下所示的 c 文件:

/* Example C, C++ code */
#include "libsbmlsim/libsbmlsim.h"
int main(void) {
/*
* Simulate sbml.xml to time=20 with dt=0.1, print_interval=10
* by 4th-order Runge-Kutta Method.
*/
myResult *r = simulateSBMLFromFile("sbml.xml", 20, 0.1, 10, 0, MTHD_RUNGE_KUTTA, 0);
write_csv(r, "result.csv"); /* Export simulation result as CSV file */
free_myResult(r); /* Free Result object */
return 0;
}

并执行“gcc test.c -o test”,但出现错误。错误信息如下:

Undefined symbols for architecture x86_64:
"_free_myResult", referenced from:
_main in test-f56b85.o
"_simulateSBMLFromFile", referenced from:
_main in test-f56b85.o
"_write_csv", referenced from:
_main in test-f56b85.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我检查了/usr/local/include/libsbmlsim/libsbmlsim.h,那里指定了 free_myResult 函数。我尝试了很多,但没有用。请帮忙。

最佳答案

I checked /usr/local/include/libsbmlsim/libsbmlsim.h, there specified free_myResult function.

这只能证实原型(prototype)存在。但是当你编译的时候,你需要告诉使用什么库来找到那些符号。因此,您需要使用 -lsbmlsim 链接库,并可能使用 -L 指定搜索库的位置,并使用 指定头文件的位置-我也是——所有这些都在你的命令行中。

或者您可以使用 Makefile .看看 Makefile在 libsbmlsim 的示例中提供。

关于c - "ERROR:Undefined symbols for architecture x86_64"在 LibSBMLSim(SBML=Systems Biology Markup Language)中出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46475514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com