Calling C++ .dll libraries from MATLAB

1.9k Views Asked by At

Hopefully you all will be having good time. I am doing one project in which I have to call .DLL and .h files written C++ into MATLAB. Actually i have to interface one USB attachable device. The API of the device is written in C++ and have one .dll and one .h file. When I am trying to call these two from the MATLAB using loadlibrary in MATLAB, its working. BUt as this is only API so i wrote one .h and .cpp file to make the use of this API. now when I am loading .dll files written by my own, I am getting an error

fatal error C1083: Cannot open include file: 'USBCommAdapter.h': No such file or directory

where USBCommAdapter.h is original header file provided by the .dll files. It is available in the working folder of the MATLAB.

Please help me to get rid of this problem.

Thanks

1

There are 1 best solutions below

3
On

The include file 'USBCommAdapter.h' should be in the search path of Matlab. An easy way is to put it in current working directory. Input path command in Matlab to check if USBCommAdapter.h is in it.