开发者

I can't make gcc work

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
      _mai开发者_高级运维n 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


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜