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!