Search code examples
c++visual-studio-2010matlabshared-librariesmatlab-deployment

Error While creating a C shared library with MATLAB to use in VS2010


I'm trying to make a C shared library.

I'm a newbie in Matlab, so I follow these steps:

http://www.mathworks.com/support/solutions/en/data/1-UR7P0/index.html?solution=1-UR7P0

I've created the Matlab files as it's written in article, and did all the steps with guidance of article. When I build my solution, I get this error..

error LNK1104: cannot open file 'foolib.lib'

Note: My MATLAB version is 7.11.0.584(r2010b)


Solution

  • You should add the foolib.lib to the linker dependencies in Visual studio. Right-Click on project -> Configuration Properties -> Linker -> Input -> Additional Dependencies. Add full path to foolib.lib here, for example "C:\MyProject\MyLib\foolib.lib"

    This is described as step 6 at your link:

    6 - After specifying the library directories, select the Input category and type the following libraries in the Additional Dependencies field: mclmcrrt.lib foolib.lib"