Using C++ shared library created by R2011b with Visual Studio 2010

1 view (last 30 days)
I tried to use a C++ shared library which I created them from 4 matlab functions with Mtlab R2011b. I configured it several time how in your webpage and others explanation I found, but at the end I received the following errors:
##########################
Creating library c:\users\y\documents\visual studio 2010\Projects\lastTestM2Cpp\Debug\lastTestM2Cpp.lib and object c:\users\y\documents\visual studio 2010\Projects\lastTestM2Cpp\Debug\lastTestM2Cpp.exp
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclDestroyStream_proxy referenced in function _matlabCalibrationInitializeWithHandlers
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclInitializeComponentInstanceEmbedded_proxy referenced in function _matlabCalibrationInitializeWithHandlers
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclGetEmbeddedCtfStream_proxy referenced in function _matlabCalibrationInitializeWithHandlers
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclmcrInitialize_proxy referenced in function _matlabCalibrationInitializeWithHandlers
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclWrite_proxy referenced in function _mclDefaultPrintHandler
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclTerminateInstance_proxy referenced in function _matlabCalibrationTerminate
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclGetID_proxy referenced in function _matlabCalibrationGetMcrID
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclFreeStackTrace_proxy referenced in function _matlabCalibrationPrintStackTrace
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclGetStackTrace_proxy referenced in function _matlabCalibrationPrintStackTrace
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclFeval_proxy referenced in function _mlxMatlabcalibration
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _array_buffer_to_cell_proxy referenced in function "void __cdecl mclcppMlfFeval(void *,char const *,int,int,int,...)" (?mclcppMlfFeval@@YAXPAXPBDHHHZZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _ref_count_obj_release_proxy referenced in function "void __cdecl mclcppMlfFeval(void *,char const *,int,int,int,...)" (?mclcppMlfFeval@@YAXPAXPBDHHHZZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _array_buffer_get_proxy referenced in function "void __cdecl mclcppMlfFeval(void *,char const *,int,int,int,...)" (?mclcppMlfFeval@@YAXPAXPBDHHHZZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclcppFeval_proxy referenced in function "void __cdecl mclcppMlfFeval(void *,char const *,int,int,int,...)" (?mclcppMlfFeval@@YAXPAXPBDHHHZZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _array_buffer_add_proxy referenced in function "void __cdecl mclcppMlfFeval(void *,char const *,int,int,int,...)" (?mclcppMlfFeval@@YAXPAXPBDHHHZZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _array_buffer_set_proxy referenced in function "void __cdecl mclcppMlfFeval(void *,char const *,int,int,int,...)" (?mclcppMlfFeval@@YAXPAXPBDHHHZZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclcppGetArrayBuffer_proxy referenced in function "void __cdecl mclcppMlfFeval(void *,char const *,int,int,int,...)" (?mclcppMlfFeval@@YAXPAXPBDHHHZZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclcppGetLastError_proxy referenced in function "public: static void __cdecl mwException::raise_error(void)" (?raise_error@mwException@@SAXXZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _mclcppCreateError_proxy referenced in function "public: __thiscall mwException::mwException(void)" (??0mwException@@QAE@XZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _ref_count_obj_addref_proxy referenced in function "public: __thiscall mwException::mwException(class mwException const &)" (??0mwException@@QAE@ABV0@@Z)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _error_info_get_message_proxy referenced in function "public: virtual char const * __thiscall mwException::what(void)const " (?what@mwException@@UBEPBDXZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _array_ref_classID_proxy referenced in function "public: enum mxClassID __thiscall mwArray::ClassID(void)const " (?ClassID@mwArray@@QBE?AW4mxClassID@@XZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _array_ref_number_of_elements_proxy referenced in function "public: unsigned int __thiscall mwArray::NumberOfElements(void)const " (?NumberOfElements@mwArray@@QBEIXZ)
1>matlabCalibration.obj : error LNK2019: unresolved external symbol _array_ref_getV_int_proxy referenced in function "public: class mwArray const __cdecl mwArray::GetPromoted(unsigned int,...)const " (?GetPromoted@mwArray@@QBA?BV1@IZZ)
###################################
I added what ever lib file is necessary (mclmcrrt.lib, mclmcr.lib, matlabCalibration.lib, mclbase.lib, mclcommain.lib), but why still "LNK2019 unresolved external symbol"?
I appreciate it, if you could tell me what is missed which causes these errors.

Answers (1)

Kaustubha Govind
Kaustubha Govind on 14 Feb 2012
Are you using 64-bit MATLAB? If yes, you may need to configure your Visual Studio project for an x64 target (by default, Visual Studio attempts to compile a 32-bit binary, which won't link against 64-bit libraries).
  1 Comment
Martin
Martin on 18 Jan 2017
i am developing on a 64bit Win10 machine with visual studio 2015 for a win xp 32bit target using the "Visual Studio 2015 - Windows XP (v140_xp)" platform toolset. what libraries di i have to link against?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!