0

I have Simple c++ Code that works fine while also using #include "engine.h" for the use of MATLAB in the c++ code.I am also using some functions like mxArray(), mxCreateDoubleMatrix() & mxSetPr(). After going to terminal and compiling the code with g++ -o main main.cpp the following errors occur

    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)

I don't think I need to put my actual code here since I am assuming this error has to do with compatibility issues not the code itself. If i'm wrong I will edit the post

P.S. I am using os Sierra. ( i have also tried compiling with xcode 9.0.1, same errors occur)

Thanks

ead
  • 32,758
  • 6
  • 90
  • 153
bcsta
  • 1,963
  • 3
  • 22
  • 61
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – ead Nov 12 '17 at 18:41
  • This answer is probably what you need: https://stackoverflow.com/a/12574400/5769463 – ead Nov 12 '17 at 18:42

0 Answers0