我无法让 gcc 工作
我必须编译一个 matlab 工具箱附带的 .c 文件。
为此,我下载了 xcode 3.1.4,现在我正在尝试类似的命令
gcc -o solvemc solvemc.c
并收到类似的错误
Undefined symbols:
"_N_VFree", referenced from:
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
"_CVDiag", referenced from:
_integrate in cca0ChgX.o
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_CVode1", referenced from:
_integrate in cca0ChgX.o
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_setall", referenced from:
_main in cca0ChgX.o
"_CVodeFree", referenced from:
_integrate in cca0ChgX.o
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_genunf", referenced from:
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
_mcwfalg in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_CVodeMalloc", referenced from:
_integrate in cca0ChgX.o
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_N_VNew", referenced from:
_mcwfalg in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I have to compile a .c file that came with a matlab toolbox.
To this end I downloaded xcode 3.1.4, and now I am trying commands like
gcc -o solvemc solvemc.c
and getting errors like
Undefined symbols:
"_N_VFree", referenced from:
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
"_CVDiag", referenced from:
_integrate in cca0ChgX.o
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_CVode1", referenced from:
_integrate in cca0ChgX.o
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_setall", referenced from:
_main in cca0ChgX.o
"_CVodeFree", referenced from:
_integrate in cca0ChgX.o
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_genunf", referenced from:
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
_mcwfalg in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_CVodeMalloc", referenced from:
_integrate in cca0ChgX.o
_docollapse in cca0ChgX.o
_mcwfalg in cca0ChgX.o
"_N_VNew", referenced from:
_mcwfalg in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来您缺少一个或多个库 - 请检查 Matlab 文档以了解编译代码所需的库。
Looks like you're missing one or more libraries - check the Matlab docs as to which libraries are required in order to compile your code.
您缺少一些库。查看您的代码使用哪些库,并将链接参数添加到您的 gcc 行:
-l
。您可能还需要添加路径:-L/path/to/libdir
。You're missing some libraries. Look at what libraries your code uses and add link parameters to your gcc line:
-l<libname>
. You may have to add paths too:-L/path/to/libdir
.您可能需要链接数学库。将
-lm
添加到您的 gcc 行。You probably need to link in the math library. Add a
-lm
to your gcc line.