Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

Static Linking still expects dll

asked 2013-05-23 12:42:19 -0500

mbsp gravatar image

updated 2013-05-23 12:46:08 -0500


First of all I am no making/linking expert, never worked on big projects. I want to use OpenCV 245 with Visual C++ 2010 Express on Windows 7 (64 bit) just for reading/writing images (*.tiff, *.jpg, ...) to/from arrays. Manipulation on this arrays will be self-made for educational purposes.

I followed the setup tutorial without setting the environmental variables (I want to write the full path manually).

  1. "...\opencv\build\include" as additional include folder (otherwise than told in the tutorial where I think there is an error with this path).
  2. "...\opencv\build\x86\vc10\lib" as additional lib folder
  3. "opencv_core245d.lib" and "opencv_highgui245d.lib" as additional dependencies
  4. code contains "#include<opencv\cv.h> #include<opencv\highgui.h> using namespace cv" and in the main function "Mat img; img = imread ("test.tiff", CV_LOAD_IMAGE_COLOR);"

The building process works, but on startup the program expects the opencv_core245d.dll.

Why is this? I also tried the vc10\staticlib folder (with libjpgd.lib, libtiffd.lib, and all others), there were so many linking errors. Whats the difference between the vc10\lib and staticlib files? And whats the difference between the opencv and opencv2 include files?

Thanks for any help!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-25 21:05:32 -0500

mbsp gravatar image

updated 2013-10-25 21:11:47 -0500

After some searching I found the answer:

Back to my points:

  1. is OK
  2. you have to take "...\opencv\build\x86\vc10\STATIClib" as additional lib folder. The files there are much more greater than in the lib folder -> because of static linking!
  3. as said + IlmImfd.lib, libjasperd.lib, libjpegd.lib, libpngd.lib, libtiffd.lib, zlibd.lib (all in staticlib folder)
  4. is OK
  5. (!!!) under project properties -> configuration properties -> c/c++ -> code generation -> runtime library -> multithreaded debug (NOT dll, this was my main missing point!!!)

You will get many build warnings, but all seems to work fine. The final .exe is much more greater than with dynamic linking. No need for CMake or environment path settings, works all fine with this points! Enjoy...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-05-23 12:42:19 -0500

Seen: 2,208 times

Last updated: Oct 25 '13