From: Michael on
I am trying to get into the MATLAB API for C/C++, therefore I wanted to test compile "engwindemo.c" in the Command Window using "mcc -m engwindemo.c" or in Visual Studio 2005. Either way I get the following error message during linking:

1>engwindemo.obj : error LNK2019: unresolved external symbol "_mxDestroyArray" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_mxGetPi" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_engClose" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_engGetVariable" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_engOutputBuffer" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_engEvalString" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_engPutVariable" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_mxGetPr" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_mxCreateDoubleMatrix_730" in function "_WinMain(a)16".
1>engwindemo.obj : error LNK2019: unresolved external symbol "_engOpen" in function "_WinMain(a)16".
1>E:\Documents and Settings\Michael\My Documents\C\MATLAB\Debug\MATLAB.exe : fatal error LNK1120: 10 unresolved external symbols.


I am using Windows XP x64 and have installed the 64-bit version of MATLAB R2009b. How can I resolve this problem?
From: James Tursa on
"Michael " <michael.schmittNOSPAM(a)bv.tum.de> wrote in message <hqpit5$1lf$1(a)fred.mathworks.com>...
> I am trying to get into the MATLAB API for C/C++, therefore I wanted to test compile "engwindemo.c" in the Command Window using "mcc -m engwindemo.c" or in Visual Studio 2005. Either way I get the following error message during linking:
>
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_mxDestroyArray" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_mxGetPi" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_engClose" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_engGetVariable" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_engOutputBuffer" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_engEvalString" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_engPutVariable" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_mxGetPr" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_mxCreateDoubleMatrix_730" in function "_WinMain(a)16".
> 1>engwindemo.obj : error LNK2019: unresolved external symbol "_engOpen" in function "_WinMain(a)16".
> 1>E:\Documents and Settings\Michael\My Documents\C\MATLAB\Debug\MATLAB.exe : fatal error LNK1120: 10 unresolved external symbols.
>
>
> I am using Windows XP x64 and have installed the 64-bit version of MATLAB R2009b. How can I resolve this problem?

Copy engwindemo.c to your working directory and make that working directory your current directory. Then try this:

mex -setup
(then press ENTER and select your VC++ 8.0 compiler)
options = [matlabroot '\bin\win64\mexopts\msvc80engmatopts.bat'];
mex('-f', options, '-v', 'engwindemo.c');

That should produce an engwindemo.exe that you can run with the bang operator:

!engwindemo

James Tursa
From: Michael on
Thanks, that helped! It was the *options.bat file that was missing.