Martej
Martej

Reputation: 55

How to use just *.lib file instead of *.dll from OpenCV C++

I'm really new in using OpenCV C++. Is there any possibility to configure my VS 2013 to configure my project to use only *.lib instead of *.dll ? I don't want to add to my final executable any *.dll files. I heard that *.lib files will during compiling just insert (sorry for this word) into this executable instead of many *.dll files around.

I was following this manual, especially the end of this with some INSTALL project. I did every step from this manual, but... It doesn't work. (I can compile testing project - here), but it always said "I can't find *.dll file and program can't run."

Thank you.

Upvotes: 2

Views: 4109

Answers (3)

bruce
bruce

Reputation: 1316

I think you can set [Build]->[BUILD_SHARED_LIBS]->value unchecked

Upvotes: 0

James Harper
James Harper

Reputation: 560

you could try static linking. but it makes the complied executable much larger and takes longer to assemble all the parts into one single executable.

it can be achieved by setting the use shared library(i.e. dll) flag off. cmake -DBUILD_SHARED_LIBS=OFF

Upvotes: 3

Die Usche
Die Usche

Reputation: 132

As far as I know, there is no way to avoid using the *.dll file. Also I guess you are trying to run your project from the VS2013 GUI. The problem is that without seperate configuration the executable expects all *.dll files at it's location.

VS locates your project's .exe file in /project/debug/.exe (or release depends on settings).

The "INSTALL" project however normally creates a seperate folder where your project is being "installed".

So you either copy your *.dll files into the project's build folder, or you build the "INSTALL" project every time and start the *.exe from the specific "install" folder.

Upvotes: 0

Related Questions