Problem with external matlab to VC++ 2008
1 回表示 (過去 30 日間)
古いコメントを表示
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 ==========
0 件のコメント
回答 (3 件)
Kaustubha Govind
2011 年 6 月 6 日
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.
0 件のコメント
Chirag Gupta
2011 年 6 月 22 日
You need to add an extra directory to the system PATH. I think you might need to add [matlabroot]\bin\win64|32
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で C Shared Library Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!