Clear Filters
Clear Filters

Why do I receive link errors when compiling the "matrixdriver.cpp" example on 64-bit Windows in Microsoft Visual Studio 2005?

1 view (last 30 days)
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)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 Aug 2010
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>

More Answers (0)

Products


Release

R2007a

Community Treasure Hunt

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

Start Hunting!