Ask Your Question

Windows linking dll error

asked 2015-09-07 02:29:23 -0500

ashray.malhotra gravatar image

Hello, I have worked extensively with openCV on my mac but I am having trouble installing it in windows. I am using visual studio 2013 as my IDE and trying to setup it up with openCV. I read this entire article and spent days trying to read up here and on Stack overflow to solve my error but am still stuck.

I have linked .lib files as referred to in the article but whenever I run my program, it says that it cant find the .dll's.

  • Why is it looking for libs? In the article above have we set up for static or dynamic linking?

I tried copying the required dll 's in the exe file of visual studio and it worked. But I dont want to do this for every project that I make hence I want it to be able to find the dll on its own.

  • I have included all the .lib files in the additional dependencies option in VS 2013. But what does it do(assuming we are doing dynamic linking here). Does it contain the address to .dll's(my best guess). In that case why cant it find dll's?

Thanks for your help.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-09-07 04:11:06 -0500

boaz001 gravatar image

updated 2015-09-07 04:20:34 -0500

Your OS does not know where to find the DLL.

One popular way of telling the OS where to look for DLL's is by adding the location to you PATH environment variable. By default it (first) also searches the directory the executable was loaded from, that's why that copying DLL's to that location also works.

edit flag offensive delete link more


A clarification to the second question. We are doing dynamic linking here right? And exactly do the lb files store(because I tried to build it without linking to the .lib files and it fails)

ashray.malhotra gravatar imageashray.malhotra ( 2015-09-07 05:14:36 -0500 )edit

Yes, dynamic linking. Simplified version; the .lib file contain a list of symbols that are exported from the DLL (functions, classes..). With this list the linker can actually link your application to a DLL because it has knowledge of what's inside the DLL.

boaz001 gravatar imageboaz001 ( 2015-09-07 08:33:15 -0500 )edit

so how do i do the above method?

kentlow2002 gravatar imagekentlow2002 ( 2016-11-07 22:08:14 -0500 )edit

Question Tools

1 follower


Asked: 2015-09-07 02:29:23 -0500

Seen: 256 times

Last updated: Sep 07 '15