Loading Third party header files in matlab

I am working on a project in which i have to load .dll files generated by C++ into MATLAB code. the project is to interface third party device via USB. My header file include third party header file and MATLAB is giving error that Cannot open thirdparty.h file...any idea how to solve this error? I am using loadlibrary command to load dll and header file.

댓글 수: 3

Friedrich
Friedrich 2013년 8월 30일
Can you post your loadlibrary command here? Where is the DLL and header file located? Keep in mind that loadlibrary works for native C style header files only.
Saad
Saad 2013년 8월 30일
편집: Saad 2013년 8월 30일
loadlibrary CNanaoLambda.dll CNanoLambda.h
The above library and header files in turn depends on .dll and .h file of a third party. Third party .h file is written in C. This is the error
??? Error using ==> loadlibrary at 441 Failed to preprocess the input file. Output from preprocessor is:CNanoLambda.h D:\matlab_lightlamp\Light_lamp\CNanoLambda.h(7) : fatal error C1083: Cannot open include file: 'USBCommAdapter.h': No such file or directory
Where USBCommAdapter.h is third party header file.
Friedrich
Friedrich 2013년 8월 30일
편집: Friedrich 2013년 8월 30일
When you run the above command the DLL and the all needed Header files must be your current folder. I assume that not the case. You need to pass down the folder where the needed header files are located. For that you need to use the -I (<=capital i) flag for mex. See the documentation for more information about that flag. Since the DLL depends on other DLLs you need to make them available to MATLAB by either copying them next to the CNanaoLambda.dll (which I wouldnt recommend doing) or by setting the PATH environment variable locally for your MATLAB by using the SETENV command.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Language Fundamentals에 대해 자세히 알아보기

태그

질문:

2013년 8월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by