我无法让 gcc 工作

发布于 2024-09-17 22:49:54 字数 1407 浏览 5 评论 0原文

我必须编译一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

呆° 2024-09-24 22:49:54

看起来您缺少一个或多个库 - 请检查 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.

岁月如刀 2024-09-24 22:49:54

您缺少一些库。查看您的代码使用哪些库,并将链接参数添加到您的 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.

北音执念 2024-09-24 22:49:54

您可能需要链接数学库。将 -lm 添加到您的 gcc 行。

You probably need to link in the math library. Add a -lm to your gcc line.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文