Question

I recently ran into this problem.I had a simple console based project in visual studio 2008 which I built in release mode and released it.

We found that in a clean windows xp sp3 machine , the executable on double clicking does not start and an error is thrown up which says that the "Configuration is incorrect". We fixed the problem by installing the VS2008 re-distributable package on the system. My question is :

1- Why did this happen? It did not happen in all xp machines but some of them. It is quite unbelievable that the files need to run a simple win32 program were not present by default in windows xp sp3. How is it then that notepad.exe and other programs where running ? One possibility that I considered might be that the run time files present in the OS were older and the exe manifest were referring to the newer version of the files. But I wonder if this is the case , as VS 2008 itself is quite old. Let me know your thoughts.

2- Since I have to run the exe in a lot of machines , I was considering a way to statically link all the needed libraries by a win32 program in VS 2008. I am aware of the /MT switch in the Linker options , but was wondering if it will take care of all the run time libraries(the C++ libraries and the other windows libraries as well).

Thanks.

Was it helpful?

Solution

  1. It happened because the VS2008 redistributables aren't installed with Windows. They must be installed by another application, which means they won't be present on virgin Windows installations. But they're likely to be present on machines which have had a few applications installed since many Windows apps use them. Native Windows applications such as Notepad don't depend on them, so it's not surprising Notepad runs without them.

  2. As typ1232 already pointed out, the /MT option will solve your problem (at the expense of increasing your EXE and DLL sizes). The libraries for native Windows APIs are guaranteed to be present unless they're specifically documented as being an option you must install separately, so you don't need to worry about them.

Testing applications with a release mode build on virgin Windows installations is a crucial step in testing any Windows application, as you've now discovered.

OTHER TIPS

The /MT option will result in the runtime library being statically linked, so the dynamic libraries don't have to be present on a target system.

The alternative is to package the redist installer with your installer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top