Using matOpen in Visual Studio 2012
1 次查看(过去 30 天)
显示 更早的评论
I'm trying to include the libmat library to be able to read .mat files in C++, however I've not been able to link it properly eventhough I've set it up exactly the same way as I have other libraries. I've tried two different approaches, but both fail.
First of all, I've added the following links in the project preferences:
VC++ Directories > Library Directories: C:\MATLABR2011b_x86\extern\lib\win32\microsoft
VC++ Directories > Include Directories: C:\MATLABR2011b_x86\extern\include
C/C++ > Additional Include Directories: C:\MATLABR2011b_x86\extern\include
Linker > Input > Additional Dependecies: libmat.lib; libmx.lib; libmex.lib
And added the libmat.dll, libmex.dll and libmx.dll to the debug folder of the project.
--------------------------------------------------------------------------------
Method 1:
#include "mat.h"
MATFile* file = matOpen("examplefile.mat","r");
I then get the following error:
First-chance exception: Microsoft C++ exception: fl::i18n::MwLcDataNotFound
--------------------------------------------------------------------------------
Method 2:
#include "mat.h"
std::string DLLFilename = "libmat.dll";
HMODULE libHandle = LoadLibrary(DLLFilename.c_str());
// I can comment out the following lines and the error persists
MATFile *(*myMatOpen)(const char*, const char*);
myMatOpen = (MATFile*(*)(const char*, const char*))GetProcAddress(libHandle, "matOpen");
And I get the same error using this method.
What am I missing?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Adding custom doc 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!