I am writing a C++ application in Visual Studio 2010 which is meant to use MATLAB for graph plotting. In order to do so I added the MATLAB dll directory in my solution:
Properties -> Debugging -> Environment -> "PATH=F:\MATLAB R2010b\bin\win32"
as well as in:
Properties -> Linker -> Input -> Additional Dependencies:
"F:\MATLAB R2010b\extern\lib\win32\microsoft\libeng.lib
F:\MATLAB R2010b\extern\lib\win32\microsoft\libmx.lib"
I also needed to include headers to MATLAB engine:
Code:
#include "engine.h"
#include "matrix.h"
#include "tmwtypes.h"
When I run my program directly from VS (start without debugging) it works properly, however if I build the app and then start the executable, it gives me an error:
Could not locate something.dll
I tried to copy the file from the directory mentioned above but then it asks for another and another until I got tired of copying all the libraties. I copied the executable to the directory "F:\MATLAB R2010b\bin\win32" and then the program works properly.
How can I make VS copy all the files for me or somehow tell the program to look for them in the matlab directory? What is the common programming practise on handling the dll libraries?