Click here to Skip to main content
14,667,169 members
Rate this:
Please Sign up or sign in to vote.
See more:

I am working on a mfc project, where i am using the opencv dll's for face recognition.

Its working fine in my computer, when i want to port my EXE file to another computer

it asks for opencv dlls (cv210d.dll, cvcore210d.dll, ...)

My question is how to do it.

Recompile opencv as static library (.lib instead of .dll). That didnt work. I get 10 linker errors.

If possible, how to merge/embedd DLL's into exe file.

P.S. - I am using visual studio 2010, openCV 2.0, and mfc Dialog based Application.
Updated 8-Nov-12 0:43am

Rate this:
Please Sign up or sign in to vote.

Solution 1

You cannot merge DLLs into an executable, they are stand-alone loadable modules. You need to copy them with your executable to the other computer. you can do this manually or by creating a setup program. You did not give details of the problems you had trying to rebuild as static libraries so we cannot offer any suggestions to fix that problem.
Kumar 09 8-Nov-12 23:31pm
hi Richard thank you for the reply,

one point i want to clear you is that when i build application using opencv dll's its working fine in my computer, whereas when i run the same application in other computer it is asking for the opencv dll's. Is there any other way that every time we dont copy these dll's in to other computer and run the application.

Thank u again in advance.
Richard MacCutchan 9-Nov-12 5:29am
No, I am afraid that is how the Windows system works. If you wish to use 3rd party DLLs in your application then you must install them with your application. The only alternative is to use static libraries, which you have already discovered is not possible.
Rate this:
Please Sign up or sign in to vote.

Solution 2

As Richard allready stated it's not possible to embed DLLs in an exe but you can copy the DLLs your program depends along with your exe.

Building openCV with its static libraries isn't very easy at the moment so it seems. I tried to do this myself a while ago but after some time considered that it would be easier just to stay with the DLLs. You can try and ask at the QA section of openCV[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100