Error using loadlibrary - error C2059

조회 수: 14 (최근 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