MATLAB to VC: Unresolved external symbol LINK error

6 views (last 30 days)
Val
Val on 23 May 2014
Commented: Val on 24 May 2014
Hi,
I am trying to statically link a DLL from MATLAB to a Visual C++ win32 app. I keep getting an error: LNK2019: unresolved external symbol _mxCalloc_proxy referenced in function "public..."
Details: The DLL was created using 32-bit Matlab 2013a on a different PC. VC++ is Visual Studio Pro 2013. I also have a 64-bit Matlab 2008a installed on this PC. I transferred my DLL together with its .lib and .h version onto this PC with VC++. To pass data to this DLL, I included "matrix.h". I tried two configurations: (i) set additional include and library directories in the project properties to the MATLAB2008\extern directories; and (ii) copy the MATLAB2013\extern directories from the other PC (where the DLL was created) to point the VC++ includes thereto. In both cases, I keep getting the "unresolved external symbol" errors during build. What am I missing? All the unresolved symbols are defined in the "matrix.h" but which library should I use?
Many thanks in advance
Val
  1 Comment
Val
Val on 24 May 2014
OK. The issue was resolved. The problem was indeed in the mismatch between 64 bit MATLAB and 32 bit Visual Studio. Setting the Visual Studio compiler into 64 bit mode solved the problem. Switching is a bit cryptic but is well described in: http://msdn.microsoft.com/en-us/library/x4d2c09s.aspx ("How to: Enable a 64-Bit Visual C++ Toolset on the Command Line"). Another helpful discussion on http://www.mathworks.com/matlabcentral/fileexchange/44051-visual-studio-2013-support-for-matlab-compiler-toolbox--x64- describes potential syntax issues with the use of mex -setup.

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!