Error using loadlibrary - error C2059

7 次查看(过去 30 天)
Roimeh
Roimeh 2013-4-9
回答: Divyanshu 2025-1-15
Hi,
I'm trying to run a dll file from a matlab script. When using loadlibrary, I get the following error:
Building CC3_thunk_pcwin64 failed. Compiler output is: cl -I"C:\Program Files\MATLAB\R2012a\extern\include" /W3 /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /nologo -I"D:\CCSW PACK\MATLAB\20130408" -I"D:\CCSW PACK\CC3\CC3" "CC3_thunk_pcwin64.c" -LD -Fe"CC3_thunk_pcwin64.dll" CC3_thunk_pcwin64.c D:\CCSW PACK\CC3\CC3\CC3.h(146) : error C2059: syntax error : 'string' D:\CCSW PACK\CC3\CC3\CC3.h(154) : error C2059: syntax error : 'string'
Last two lines continue in the same pattern (not shown) - each corresponds to the line that holds a function definition in 'CC3.h'. All of them look more or less like: extern "C" __declspec(dllexport) int FuncName
I'm using a 64 bit environment, matlab version R2012a, VS 2010 express, latest SDK and its patch.
In VS it builds successfully. I've used the 'mex -setup' prior to running the matlab script.
In matlab I call the function as so: loadlibrary([dllPath,'\x64\Debug\CC3.dll'],[dllPath,'\Proj\CC3.h']);
It worked fine before trying to switch to the 64 bit architecture.
I'd appreciate any help, Roi

回答(1 个)

Divyanshu
Divyanshu 2025-1-15
Hello @Roimeh,
You can refer the following MATLAB answer thread which addresses a similar issue of getting error 'C2059: syntax error: "string"' using loadlibrary:
Hope it helps!

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by