0

I have created a cpp file using Microsoft Visual Studio 2010 and Allegro. It runs perfectly fine in the Visual Studio interface, but when I compile it into an exe, it says:

"The program can't start because allegro-5.0.10-monolith-md-debug.dll is missing from your computer. Try reinstalling the program to fix this problem."

I am running the exe on the same computer I used to write the code and debug it, so it shouldn't be the fault of a missing dll. Should it? That doesn't make sense to me.... I have compiled other exes before, and they do run on other computers, and the Allegro one works just fine while it's a cpp file, but when the Allegro file is run as an exe, it says I don't have the monolith thing.

Why is the file failing as an exe, but not a cpp?

user2759989
  • 1
  • 1
  • 2
  • 3
    It likely means Visual Studio is providing the path that contains `allegro-5.0.10-monolith-md-debug.dll` somewhere so running it in the IDE can load it successfully. Easy solution is to find that missing dll on your machine and copy it over to the same location as your exe. – greatwolf Sep 09 '13 at 01:28
  • When you run the program in the IDE the default working directory, or where it would load DLL files, is the same as where the project is. If you navigate to the debug or release directory and double click it then the working directory is the debug or release directory, and most likely not where the dll it needs is. – Retired Ninja Sep 09 '13 at 01:29
  • As others have noted, this is a matter of the required .dll files having to be on the search path for DLLs. See [DLL search on windows](http://stackoverflow.com/questions/2463243/dll-search-on-windows) for details on the search path for DLLs. – Simon Sep 09 '13 at 01:31
  • To clear the question, cpp as a compiling unit won't run by any means, the executable does, which is PE/COFF format on Windows. – lulyon Sep 09 '13 at 01:57
  • Dude, just put the DLL file in the same directory that the EXE is in. And then go and read about DLL search path and DLLs themselves! – yzt Sep 09 '13 at 02:10
  • 2
    When you're building a standalone executable, you probably want to switch to release mode, so it won't try to use the debug DLL. Not sure if it'll help, but it might (if the debug DLL is on a path that's only made known to VS, but the release DLL is, for example, on the PATH). – Jerry Coffin Sep 09 '13 at 02:10

1 Answers1

0

This is what worked for me:

When in Configuration Properties -> Debugging - Add PATH=c:\allegro\bin;%PATH% to the Environment Variable.

I had the exact same error, the program was telling me that it couldn't find the monolith DLL file. What I had noticed is instead of PATH=c:\allegro\bin;%PATH% I had put PATH=c:\allegro\bin:%PATH%. The difference is not easy to spot.

I put a : instead of a ; between bin and %PATH%

it was an easy mistake, however it caused me about 3 hours of heartache to fix.

HRM
  • 2,097
  • 6
  • 23
  • 37
TylorF
  • 11
  • 1
  • 4