Include external libraries in Mex files
5 次查看(过去 30 天)
显示 更早的评论
I am just playing around with mex files and wish to call an external library in a mex file. I have this code and some more after it. The linking fails even though I include everything in the -I -L and -i options.
#include "gdcmImageReader.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
char *filename;
filename = mxArrayToString(prhs[0]);
gdcm::ImageReader reader;
reader.SetFileName( filename );
then when I compile I get something like this
error LNK2019: unresolved external symbol "public: void __cdecl gdcm::Reader::SetFileName(char const *)" (?SetFileName@Reader@gdcm@@QEAAXPEBD@Z) referenced in function mexFunction
Are you allowed to call external libraries?
2 个评论
James Tursa
2015-7-2
You need to show us the exact commands you are using to mex the code. What you are currently doing is not linking in the necessary libraries.
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!