编译包含MATLAB Engine Library的c ++代码时构建错误

时间:2017-11-12 17:04:31

标签: c++ matlab linker linker-errors

我有简单的c ++代码工作正常,同时也使用#include "engine.h"在c ++代码中使用MATLAB。我也使用了一些函数,如mxArray()mxCreateDoubleMatrix()& mxSetPr()。转到终端并使用g++ -o main main.cpp编译代码后,会出现以下错误

    Undefined symbols for architecture x86_64:
      "_engClose", referenced from:
          _main in main-438cf4.o
      "_engEvalString", referenced from:
          _main in main-438cf4.o
      "_engOpen", referenced from:
          _main in main-438cf4.o
      "_engPutVariable", referenced from:
          _main in main-438cf4.o
      "_mxCreateDoubleMatrix_730", referenced from:
          _main in main-438cf4.o
      "_mxSetPr", referenced from:
          _main in main-438cf4.o
      ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

我认为我不需要在此处放置我的实际代码,因为我假设此错误与兼容性问题有关,而不是代码本身。如果我错了,我会编辑帖子

P.S。我正在使用os Sierra。 (我也尝试使用xcode 9.0.1编译,发生相同的错误)

由于

0 个答案:

没有答案
相关问题