Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: etimar on December 19, 2007, 06:10:58 pm

Title: Problem when deploying Windows app.
Post by: etimar on December 19, 2007, 06:10:58 pm
Hi all,

I developped a very simple C command line program. It works quite well on my machine where C::B is installed, but refuse to execute on another machine, though I deploy it with the "msvcr80.dll" and the corresponding ".exe.manifest" file... It only displays an alert box with the following error message: "This application cannot be launched because application configuration is uncorrect" (approximative translation from the french original message).

I tried to add several other DLLs, tried to rebuild my app with differents compilation options, but nothing worked...

Both machines are under Windows XP SP2
I use C::B with the Microsoft Visual C++ 2005 compiler

Does anybody have an idea ?
Thanks.
Title: Re: Problem when deploying Windows app.
Post by: stahta01 on December 19, 2007, 07:06:36 pm
Did you try it on you own machine after setting PATH?

Open CMD window, after copying all the files needed to folder c:\test. I use dotest for your command name.

cd c:\test
SET PATH=c:\test
dotest


If the above works, I have no idea on how to proceed. If it fails, add a single path from your normal PATH setting to determine which folder contains the needed DLLs. Once you find the folder look at the DLLs in the folder.

Note, it might be easier to use an tool to find the problem, but they sometimes fail for weird code.
Tools like PEInfo.exe or depends.exe

Tim S
Title: Re: Problem when deploying Windows app.
Post by: thomas on December 19, 2007, 07:09:20 pm
Run depends path\to\your\program.exe

That should show all needed libraries. Then make sure they're accessible via path, like stahta01 said (usually, such a problem is . missing in PATH).
Title: Re: Problem when deploying Windows app.
Post by: Biplab on December 20, 2007, 06:32:08 am
I developped a very simple C command line program. It works quite well on my machine where C::B is installed, but refuse to execute on another machine, though I deploy it with the "msvcr80.dll" and the corresponding ".exe.manifest" file... It only displays an alert box with the following error message: "This application cannot be launched because application configuration is uncorrect" (approximative translation from the french original message).

I tried to add several other DLLs, tried to rebuild my app with differents compilation options, but nothing worked...

Both machines are under Windows XP SP2
I use C::B with the Microsoft Visual C++ 2005 compiler

I guess you are the victim of the Side-by-side Assemblies implementation which has been introduced in MSVC 2005. When you distribute the manifest file, the SXS manager reads it to find out the shared library your application is looking for. It generally starts the search for C Runtime DLLs %WINDIR%\WinSXS\{crappy-named-folder}\msvcrt.dll. Read it more at the following link.

Quote
http://msdn2.microsoft.com/en-us/library/aa376307.aspx


To fix these read the following articles to find out how you want to do it.

Quote
http://msdn2.microsoft.com/en-us/library/ms235285(VS.80).aspx

But I can't tell you which one is the best deployment method as I have never tried them. :)
Title: Re: Problem when deploying Windows app.
Post by: etimar on December 20, 2007, 12:17:28 pm
Thank you very much for all your answers.

I finally succeeded in deploying my app, by running "vcredist_x86.exe" on the target computer, as explain in http://msdn2.microsoft.com/en-us/library/ms235291(VS.80).aspx (http://msdn2.microsoft.com/en-us/library/ms235291(VS.80).aspx).

It is obviously not the best way for deploying apps, but it seems to be the only way for those who have the "Express" (free) version of MSVC 2005...

Thank you again, and long life to C::B.
Title: Re: Problem when deploying Windows app.
Post by: Ibbur on December 20, 2007, 02:15:42 pm
Hello,
you could use NSIS (http://nsis.sourceforge.net) for deploying your app with an installer. That's like the other method with the vs-setup-project.

If you want to start your app everywhere without having to install anything, instead of /MD use the /MT compiler option, which statically links your app to the multithreaded c/c++ runtime. This compiler flag is also available via the Code::Blocks project's build options dialog.