Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted
Comments
YvesDaoust 4-Jun-13 11:22am    
I am not sure that the Windows operating system is deemed to have preinstalled run-time libraries (DLLs). They are not part of the distribution.
The run-time libraires are meant to be used by application developers with Visual Studio. Microsoft grants you the right to redistribute them. Windows utilities should not require them.
/MT and /MTd will link statically with the required run-times libraries and the executable will be self-contained. Anyway, mind possible incompatibilities with third-party libraries.
kaushik_code 4-Jun-13 12:57pm    
thanks for your response , but re-distributing the dlls doesnt seem to be an option to me always. As we are not sure which all dll's are required. The option of redistributing the entire re-dist package makes my software package unnecessarily too heavy. I believe windows OS does come with the required libraries to run win32/mfc apps.
YvesDaoust 4-Jun-13 13:35pm    
I didn't mean that you should redistribute the DLLs. I just meant that the redistributable are not preloaded, they have to be redistributed otherwise there would be no point making them redistributable. Use static linking.
AlphaDeltaTheta 4-Jun-13 12:09pm    
SBS configuration... check for appropriate dll versions
Philippe Mori 5-Jun-13 22:54pm    
A clean installation of a given OS will generally not have DLL that were created after the OS.

Each version of the compiler has its own version of the run-time. On a clean system, I would think that you would have only the run-time from the version of the compiler that was used to build that OS. In fact, probably most of the OS does not use the run-time but maybe a few application bundle with the system.

Depending on your scenario, you might tell your user where to download it if they need it or provide it in your setup. Usually there is a way to specify dependencies when you build the installer. In VS 2008, you might use merge modules.

As other have mentionned, it might be easier to statically links the run-time particulary if the application otherwise does not strictly require an installer but it is always a good idea to provide an installer as program will be shown as installed in Windows Add/Remove programs which is definitively a nice thing.

1 solution

Visual c++ apps have a c special run-time for standard c library functions. There may be number of versions of the dll in your system, but the app is linked to a particulan dll version. This dll is provided by the Side By Side system by checking for the appropriate version in the app manifest. If the requested version is not found, an error is generated. You can use the sxstrace tool (included in windows) to trace sbs configuration problems.

However in the case of windows libraries, they (mostly) use native windows apis (? I don't have their source code!). If at all they refer to standard c libraries, they are dynamically linked to msvcrt.dll, the default c runtime of windows.

You can also link to msvcrt, unless you require a special feature found only in the particular vs version crt.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900