You are probably using the code that has been compiled elsewhere, or you have not set the path environment variable. Make sure that the path environment variable points to where the OpenCV dll files reside. If you tell me the Windows version you are using, I can give you instructions to set the environment variable.