-1

-Part0

My EXE(Debug) using mfc built with vs2012, fails to work on a PC with only vs2013.

Error Information: lacking mfc100ud.dll

It is quite similar when the EXE using mfc built with vs2013 runs on my pc with only vs2012

Error Information: lacking mfc120ud.dll

I think it is because of the building mode for mfc in the properties of building setting. But I do not know how to solve the problem properly.

I try to build the project (release), but the exe immediately breaks down even on my own pc.


-Part1

I try to abandon mfc, and build the core program only with console. The Debug edition can run successfully, but the release edition again breaks down quickly when linking to dll (either built in debug mode or release mode), cout some messy codes.


My question is: How to ensure a mfc EXE or at least a Console EXE smoothly run on most pc with Windows?

Thanks for your help!

shrekshao
  • 388
  • 4
  • 12

1 Answers1

2

You'll need to build in release mode. If you build in debug mode, the EXE expects to have certain DLLs present, and if I recall correctly those are only present when the same version of Visual Studio that you built the app with is installed.

cf-
  • 8,598
  • 9
  • 36
  • 58
  • Thanks. But when build in release mode with vs 2012, I can't run the EXE even on my own PC. It immediately breaks when I doubleclick it. What are the possible reasons please? – shrekshao Mar 04 '14 at 00:49
  • What do you mean by "immediately breaks"? – cf- Mar 04 '14 at 00:59
  • Sorry it is not precise. It breaks when I add a dll (either debug edition or release). There jumps a window simply telling the program breaks, with three options: connect to the Internet for solutions, debug, and shut down. – shrekshao Mar 04 '14 at 01:05
  • What DLLs are you trying to link to? – cf- Mar 04 '14 at 01:22
  • My own dll, functioning as different AI. It turns out that if I choose Release mode for both the EXE and DLL, and select support for public language, they run successfully. – shrekshao Mar 05 '14 at 00:02
  • @FlaringFalcon Yes, you need to have all DLLs built the same way as the EXE. If the build flags are different, crashes can occur. (I take it your DLL is making use of STL types? That's an especially well-known problem.) – cf- Mar 05 '14 at 00:11
  • Thank you. But the EXE (release) itself now cannot run on other pc (without linking to DLL). The error message is cannot find mfc110u.dll, but I definitely find the precise mfc110u.dll in that computer. How can I solve this at least? – shrekshao Mar 05 '14 at 12:58
  • According to [this StackOverflow answer](http://stackoverflow.com/a/14752373/2245528), you need to copy `mfc110u.dll` from your development machine into the same folder as your EXE before you copy it to the other computer, or use the installer linked in that answer (although I'm not sure I'd recommend that installer, since that answer is over a year old now). – cf- Mar 06 '14 at 07:51
  • Yes, copy the dll into the same folder as EXE (release) works! – shrekshao Mar 07 '14 at 08:33