Borrar filtros
Borrar filtros

Problem with external matlab to VC++ 2008

2 visualizaciones (últimos 30 días)
Yang
Yang el 6 de Jun. de 2011
Dear all,
I meet a problem that when I follow the tutorial about how to call matlab function in C. And I use VC++ 2008, I have already set
Additional Include Directories F:\MATLAB\R2009b\extern\include
Additional Library Directories F:\MATLAB\R2009b\extern\lib\win64\microsoft
Additional Dependencies libeng.lib libmx.lib libut.lib
But it still shows the linking error:
1>------ Build started: Project: matlab_test, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>Linking...
1>main.obj : error LNK2019: unresolved external symbol _engClose referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _mxGetClassName referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _engGetVariable referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _engOutputBuffer referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _mxDestroyArray referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _engEvalString referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _engPutVariable referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _mxGetPr referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _mxCreateDoubleMatrix_730 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _engOpen referenced in function _main
1>C:\Users\Administrator\Documents\Visual Studio 2008\Projects\matlab_test\Debug\matlab_test.exe : fatal error LNK1120: 10 unresolved externals
1>Build log was saved at "file://c:\Users\Administrator\Documents\Visual Studio 2008\Projects\matlab_test\matlab_test\Debug\BuildLog.htm"
1>matlab_test - 11 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Respuestas (3)

Kaustubha Govind
Kaustubha Govind el 6 de Jun. de 2011
It is possible that your Visual C++ project is configured to compile a 32-bit application (so it cannot recognize the 64-bit binaries libeng.lib, libmx.lib, etc.). See How to: Configure Visual C++ Projects to Target 64-Bit Platforms.
If this doesn't resolve the issue, you may be missing additional linker options. First try compiling the application using the MEX command and use the mex -v option to see the exact compiler/linker commands required in your Visual C++ project.

Walter Roberson
Walter Roberson el 21 de Jun. de 2011

Chirag Gupta
Chirag Gupta el 22 de Jun. de 2011
You need to add an extra directory to the system PATH. I think you might need to add [matlabroot]\bin\win64|32

Categorías

Más información sobre C Shared Library Integration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by