简体   繁体   中英

cannot find dll vs2010 c

I have a managed exe calling a managed dll, both written in c, and compiled using vs2010 c++.

When I run the program I get error that program can't start because the dll is missing from my computer. In the linker, under Linker->Input->Additional dependencies I have added the folder containing the dll lib. Also, in the Linker->General section I have listed the folder under Additional include libraries.

I am clueless...

The problem is that the dll was not in the same dir as where the .exe was being executed. However, since I didn't want to manually copy the dll each time, and since it was being used by other .exes, the better solution was to add a post-build event.

One more important note: Afraid of getting nicked with another -1 for asking a bad question, I spent a couple of hours coming up with the magic potion/incantations needed to do such a post-build copy. Here it is. Note the use of the macros, the /Y, and especially the quotes around the whole mess of each pathname.

xcopy /Y "$(SolutionDir)x64\Release\mcDll.dll" "$(SolutionDir)stream\x64\Release"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM