Given the example file matcreat.cpp on linux with GCC and Matlab installed correctly. I can link with
The resulting executable will work as intended. However, how do I know that I chose the correct libraries? If I remove all but -lmat I will receive "undefined reference to symbol 'mxCreateDoubleMatrix@@v7.3'. This appears to be something in the mxArray set of functions so I added -lmx and all the errors are resolved. The code compiles correctly and the output is as expected. I assume from this that -lmex -lm are extra and not needed, or found by the linker per normal processing. If I compile this same code with no libraries I get the following.
...
...
...
...
...
...
...
...
...
...
...
...
...
My question is what is the documentation or reference to tell me that I need to link against -lmat and -lmx for my code? And by extension which libraries to use for other features like the engine.
댓글 수: 1
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/438173-how-to-determine-which-libraries-to-include-when-using-matlab-c-api#comment_658361
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/438173-how-to-determine-which-libraries-to-include-when-using-matlab-c-api#comment_658361
댓글을 달려면 로그인하십시오.