Why do I receive link errors when compiling the "matrixdriver.cpp" example on 64-bit Windows in Microsoft Visual Studio 2005?
조회 수: 3 (최근 30일)
이전 댓글 표시
I use 64-bit MATLAB Compiler C++ 4.6 (R2007a) to build a C++ shared library "libmatrixp.dll". When I build the driver "matrixdriver.cpp" on 64-bit Windows in Microsoft Visual Studio 2005, after properly setting the link and include paths, I receive link errors:
1>------ Build started: Project: matrixtest, Configuration: Debug Win32------
1>Compiling...
1>matrixdriver.cpp
1>Compiling manifest to resources...
1>Linking...
1>matrixdriver.obj : error LNK2019: unresolved external symbol
_mclTerminateApplication referenced in function
__catch$?run_main@@YAPAXPAX@Z$0
1>matrixdriver.obj : error LNK2019: unresolved external symbol
_libmatrixpTerminate referenced in function
__catch$?run_main@@YAPAXPAX@Z$0
1>matrixdriver.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) void __cdecl eigmatrix(int,class mwArray &,class
mwArray const &)" (__imp_?eigmatrix@@YAXHAAVmwArray@@ABV1@@Z) referenced
in function "void * __cdecl run_main(void *)" (?run_main@@YAPAXPAX@Z)
1>matrixdriver.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) void __cdecl multiplymatrix(int,class mwArray
&,class mwArray const &,class mwArray const &)"
(__imp_?multiplymatrix@@YAXHAAVmwArray@@ABV1@1@Z) referenced in function
"void * __cdecl run_main(void *)" (?run_main@@YAPAXPAX@Z)
1>matrixdriver.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) void __cdecl addmatrix(int,class mwArray &,class
mwArray const &,class mwArray const &)"
(__imp_?addmatrix@@YAXHAAVmwArray@@ABV1@1@Z) referenced in function
"void * __cdecl run_main(void *)" (?run_main@@YAPAXPAX@Z)
1>matrixdriver.obj : error LNK2019: unresolved external symbol
_libmatrixpInitialize referenced in function "void * __cdecl
run_main(void *)" (?run_main@@YAPAXPAX@Z)
1>matrixdriver.obj : error LNK2019: unresolved external symbol
_mclInitializeApplication referenced in function "void * __cdecl
run_main(void *)" (?run_main@@YAPAXPAX@Z)
채택된 답변
MathWorks Support Team
2010년 8월 4일
To ensure you do not get linker errors when building applications in Visual Studio that link against MATLAB DLLs, these are few things to verify:
1. Check that you have included references to all the dependent libraries. Refer to the Related Solution at the bottom of the page for a detailed description on this:
2. Check the target machine flag in Visual Studio: This should correspond to the libraries that you are linking against. For example, if you specify '/MACHINE:AMD64', it should link against only the 64-bit MATLAB libraries. If you specify '/MACHINE:X86', it should link against only 32-bit MATLAB libraries.
For additional information on how the target platform of the Visual Studio project can be changed, refer to "How to: Configure Visual C++ Projects to Target 64-Bit Platforms" at:
<http://msdn2.microsoft.com/en-us/library/9yb4317s(VS.80).aspx>
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Deploy to C++ Applications Using mwArray API (C++03)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!