Error using loadlibrary line 440
1 view (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 15 Jun 2016
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.
Accepted Answer
More Answers (1)
Philip Borghesani
on 15 Jun 2016
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.
See Also
Categories
Find more on C Shared Library Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!