- The INCLUDE directory will likely be at a place like /usr/local/matlab/R2009a/extern/include.
- The LIBS directory will likely be at a place like /usr/local/matlab/R2009a/bin/glnxa64 (64-bit bit), or glnx86 (32-bit)
Mex libraries for accessing matlab code from C++
2 次查看(过去 30 天)
显示 更早的评论
Hi Matlab experts,
I am new to the forum, so any help will be highly appreciated. I am using a C++ code, which calls functions from Matlab, using the engine:
#include "engine.h"
and uses Engine *ep, to call functions like: mxCreateDoubleMatrix(), engPutVariable(), etc., and computes a cholesky decomposition: engEvalString(ep, "U=chol(T);");.
The C++ code I am working on is from 2002, and uses Matlab R13, Linux version. It accesses the following libraries from the Makefile:
INCLUDE= -I/apps/common/matlab/R13/Linux/extern/include
LIBS= -L/apps/common/matlab/R13/Linux/extern/lib/glnx86 -lmx -lut -lmat -leng
The problem is that when I try to use a newer version of Matlab, such as 2009a on an Ubuntu machine, the libraries -lmx -lut -lmat -leng are no longer existent. Currently, without these, I get these errors (I do include the "engine.h" file):
./src/monte.cpp: In member function ‘bool CMonte::CalChol(Engine*, double*, std::vector<EleDecomp, std::allocator<EleDecomp> >*&)’:
./src/monte.cpp:346: error: ‘mxSetName’ was not declared in this scope
./src/monte.cpp:349: error: ‘memcpy’ was not declared in this scope
Please let me know if anyone has some experience with this. It will be highly helpful for me. Thanks,
Saket Gupta
0 个评论
采纳的回答
Ken Atwell
2012-6-3
Saket,
Those libraries still exist, but they would be at a different location in R2009a:
if you run MEX from within MATLAB with the -v switch, it will spit out verbose information, including the directory paths you need to specify with -I and -L
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call C++ from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!