Visual Studio 2010 and MAT-Files

3 views (last 30 days)
I am trying to build a stand-alone application what will build a mat file with some input file data. I am currently working on using Visual C++ and compile with Visual Studio 2010. I have followed several tutorials on building against library files to no avail; I always see the error: "error LNK2019: unresolved external symbol _matClose referenced in function _wmain" .
I have set the path (C:\Program Files\MATLAB\R2010b\extern\lib\win64\microsoft) to the lib files in Configuration Properties > Linker > General > Additional Library Directories
I have set the library file names (libmat.lib, libmx.lib) in Configuration Properties > Linker > Input > Additional Dependencies
I have set the include file path (C:\Program Files\MATLAB\R2010b\extern\include) in Configuration Properties > C/C++ > General > Additional Include Directories
I don't see any error about not being able to find the .lib file, but I see one if I alter one of the .lib files names to a file that does not exists. I am fairly certain the lib files are being found at compile time. The header files also seem to be set up correctly.
I don't have any ideas left in this noggin so if ANYONE has ANY idea I would really appreciate it.
If I am trying to do something that isn't possible, please let me know so I don't spin my wheels any longer. If I am missing a step somewhere in the chain, I would really appreciate that info, as well.
Environment: -Windows 7 64 bit -Visual Studio 2010 Pro -MATLAB R2010b

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 11 Mar 2011
Edited: Kaustubha Govind on 9 Sep 2013
Have you tried the example in the documentation to verify whether you are setting all compiler and linker options correctly? If you compile with the -v option, you should see the exact compile/linker commands that are used.
Compare these with the commands that Visual Studio uses (I believe they are displayed in the bottom panel during compilation).
Also, do you see linker errors only for _matClose? I'm surprised that it can resolve the other symbols like matOpen, matPutVariable, etc.
  3 Comments
Ragaar Ashnod
Ragaar Ashnod on 9 Sep 2013
The provided url is broken as of 9/9/2013.
Kaustubha Govind
Kaustubha Govind on 9 Sep 2013
Sorry about that! Fixed the link.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!