Error using loadlibrary line 440
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello. I am trying to connect an EPOS controller with Matlab through a .dll file. I use Matlab function loadlibrary('EposCmd64.dll','Definitions.h') and keep getting the same error
Error using loadlibrary (line 440)
Building EposCmd_thunk_pcwin64 failed. Compiler output is:
cl -I"C:\Program Files\MATLAB\R2014b\extern\include" /W3 /nologo -I"C:\Program
Files\MATLAB\R2014b\extern\include" -I"C:\Program Files\MATLAB\R2014b\simulink\include"
/D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0
-I"C:\Users\Konstantinos\Desktop\Thesis\MAT_epos_con"
-I"C:\Users\Konstantinos\Desktop\Thesis\MAT_epos_con" "EposCmd_thunk_pcwin64.c" -LD
-Fe"EposCmd_thunk_pcwin64.dll"
EposCmd_thunk_pcwin64.c
C:\Users\Konstantinos\Desktop\Thesis\MAT_epos_con\Definitions.h(121) : error C2059: syntax
error : 'string'
The last line keeps on repeating for the rest lines of 'Definitions.h' . I have searched and tried almost everything so far. I have the Microsoft Visual Studio C++ 2015 SDK so I believe I have all the necessary stuff. Also, I can't create MEX files because the functions are too many to create!
Thanks in advance, Konstantinos
댓글 수: 2
Walter Roberson
2016년 6월 15일
Are you trying to use the C++ "string" datatype in the interface? Your .c file implies you are using C rather than C++, and you could have problems if you try to mix the two.
채택된 답변
추가 답변 (1개)
Philip Borghesani
2016년 6월 15일
The header file as written is not compatible with C code only c++. On first inspection It looks like the dll might be callable from c and usable with loadlibrary but the header will need to be fixed.
The basic problem is the definitions that look like:
#define Initialisation_DllExport extern "C" __declspec( dllexport )
and there use. The simplest fix to get loadlibrary working would be to remove all references to these defines from the code they are not needed for loadlibrary.
참고 항목
카테고리
Help Center 및 File Exchange에서 C Shared Library Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!