1

I have written a C application that depends on a few DLLs and am having some trouble when using the local debugger. It's this well documented error message:

"This program can't start because xxx.dll is missing from your computer."

Right now it's portaudio_x86.dll but the DLL is arbitrary as I'm getting the same behaviour for a bunch of others (libfftw3-3.dll, libsamplerate-0.dll, libsndfile-1.dll...)


I have been to Configuration Properties\Debugging and changed the Environment to:

PATH =

C:\portaudioASIO\portaudio\lib;%PATH%

(where the portaudio dll is)
and Merge Environment is 'Yes' (I've tried every combination and permutation of the PATH with appending, prepending, having $(ProjectDir) in the mix - all to no avail)

but this doesn't resolve it and I still get the error message "dll not found" when I debug.


I'm currently working around it by including the DLLs in the debug folder but this seems like a bit of a hack to me and from reading all the other posts [ 1, 2, 3 ] about setting the Environment PATH variable I can't see why it doesn't work.

Any tips on how to get the PATH variable to behave properly ? Cheers!

This is using MSVS Community 2015, the app is in C but the same thing happens with a C++ version.

Community
  • 1
  • 1
lloydlala
  • 19
  • 2
  • What happens if you copy the libraries into the same path where your executable is ? – Jabberwocky Jul 14 '16 at 10:10
  • @MichaelWalz Yup that's what I'm doing right now and it works fine. I don't see why the PATH variable method doesn't work though – lloydlala Jul 14 '16 at 10:47
  • Try the following on cmd prompt: `echo %PATH%` just to check whether the `PATH` variable is modified correctly. Also try restarting the PC after modifying the variable. – sameerkn Jul 14 '16 at 10:56
  • Are you running from a cmd prompt - 32 or 64bit? – cup Jul 14 '16 at 10:57
  • @cup This is using the debugger in the Visual Studio IDE, not from a cmd prompt. The app is 32 bit. – lloydlala Jul 14 '16 at 11:08
  • @sameerkn This isn't editing the PATH variable for the PC, it's just setting the path being searched by the debugger. That's my understanding anyway. I have just tried adding it to the system PATH variable though - and Visual Studio is still giving the "dll not found" error – lloydlala Jul 14 '16 at 11:13
  • If the PATH is changed, VS needs to be restarted otherwise the new path will not be picked up. – cup Jul 14 '16 at 12:12
  • @cup this is not changing the Windows Environment Path - it is just appending the path to the DLL to the Windows Path. So `%PATH%` is the Windows Path and I am telling the debugger to use `C:\portaudioASIO\portaudio\lib; %PATH%` so it should see both the DLL Path and the windows Path. and this is still throwing the "dll not found" error – lloydlala Jul 14 '16 at 13:13
  • ok so I made a mistake earlier - adding the directory to the Windows Environment Path does fix the problem. I hadn't restarted Visual Studio that time. BUT adding the path in Visual Studio is still not correctly modifying the Path that the debugger uses which is what I want to fix – lloydlala Jul 14 '16 at 13:46
  • So are you changing Project->Properties->Configuration Properties->Debugging, Environment to set the path? Is Merge Environment set to "yes" – cup Jul 14 '16 at 16:00
  • @cup Yup, that's exactly what I've done. For some reason it's not working correctly and I'm not sure how to go about fixing it. I haven't tampered with any other settings - all I've asked for is Visual Studio to also include the DLL directory along with the system path but it's not doing that – lloydlala Jul 15 '16 at 06:15

0 Answers0