MATLAB R2012a与vs2010混合编程 error LNK2019

MATLAB R2012a与vs2010混合编程问题

当按照如下连接:

http://blog.sina.com.cn/s/blog_a5fdbf0101018n91.html

配置好后,出现连接错误:

Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl add(int,class mwArray &,class mwArray const &,class mwArray const &)" (__imp_?add@@YAXHAAVmwArray@@ABV1@1@Z) referenced in function _main 

Error 2 error LNK2019: unresolved external symbol _addInitialize referenced in function _main 

Error 3 error LNK2019: unresolved external symbol _mclGetMatrix_proxy referenced in function "public: __thiscall mwArray::mwArray(unsigned int,unsigned int,enum mxClassID,enum mxComplexity)" (??0mwArray@@QAE@IIW4mxClassID@@W4mxComplexity@@@Z) 

Error 4 error LNK2019: unresolved external symbol _mclcppGetLastError_proxy referenced in function "public: static void __cdecl mwException::raise_error(void)" (?raise_error@mwException@@SAXXZ) 

Error 5 error LNK2019: unresolved external symbol _mclcppCreateError_proxy referenced in function "public: __thiscall mwException::mwException(void)" (??0mwException@@QAE@XZ) 

Error 6 error LNK2019: unresolved external symbol _ref_count_obj_addref_proxy referenced in function "public: __thiscall mwException::mwException(class mwException const &)" (??0mwException@@QAE@ABV0@@Z) 

Error 7 error LNK2019: unresolved external symbol _ref_count_obj_release_proxy referenced in function "public: virtual __thiscall mwException::~mwException(void)" (??1mwException@@UAE@XZ) 

Error 8 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)

Error 9 error LNK2019: unresolved external symbol _array_ref_get_numeric_mxDouble_proxy referenced in function "public: void __thiscall mwArray::GetData(double *,unsigned int)const " (?GetData@mwArray@@QBEXPANI@Z) 

Error 10 error LNK2019: unresolved external symbol _array_ref_set_numeric_mxDouble_proxy referenced in function "public: void __thiscall mwArray::SetData(double *,unsigned int)" (?SetData@mwArray@@QAEXPANI@Z) 

Error 11 error LNK1120: 10 unresolved externals 


由于以上连接中采用的是32位,此操作系统为64位,MATLAB R2012a为64位,解决办法:



打开配置管理器,如下:

MATLAB R2012a与vs2010混合编程 error LNK2019_第1张图片


点击WIN32后的小按钮,点new,加入64位,如下图:

MATLAB R2012a与vs2010混合编程 error LNK2019_第2张图片

后,单击确定,进行编译,即Build,成功编译。

若出现黑框后消失,Debug时选择Start Without Debugging,在DOS状态下运行,即可看到结果,如下图:

MATLAB R2012a与vs2010混合编程 error LNK2019_第3张图片



你可能感兴趣的:(MATLAB,与vs混合编程)