"This application has failed to start because the application configuration is incorrect. Reinstalling this application may fix this error"

I have created a c++ console application and a c++ dll using Visual Studio 2005.  The console application cals into exported functions in the dll.

Everything works fine on my main machine but when I transfer my exe and dll over to another laptop (which does not have visual studio installed) I get the following error:

"This application has failed to start because the application configuration is incorrect.  Reinstalling this application may fix this error"

What is wrong?
Wanting2LearnManAsked:
Who is Participating?
 
pgnatyukCommented:
I hope you know that you can create Win32 application (not a console, select "Empty project" and add a cpp-file manually) that will have just few lines and will not show this console window.
Then, in the project settings you can change C/C++->Code Generation->Runtime Library to "Multi-Threaded (/MT).
The code in the cpp-file is simple:
#include
//declaration of the imported function

int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)
{
   //call the function
   return 0;
}

Also you can load the dll dynamically and show a user friendly error message if something went bad.

Such executable (release) will be about 50K and will depend only from KERNEL32.DLL and NTDLL.DLL.
0
 
js-profiCommented:
client needs to install VS2005 runtime. download from MS service.
0
 
evilrixSenior Software Engineer (Avast)Commented:
I'd suggest you have missing DLLs on the other machine.You can probably use Dependency Walker to identify what is required and what is missing.http://dependencywalker.com/
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
pgnatyukCommented:
I'd begin from Dependency Walker as evilrix said.

I think you need to install MS Visual C++ redistributable package:
http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en

Also you can try to modify the project settings for your projects - C Run-Time libraries, for example.
0
 
Wanting2LearnManAuthor Commented:
Thanks for quick replies.

Ok I found about 5 missing dlls using dependency walker now I am getting this error:

"At least one module has an unresolved import due to a missing function in a delay-load dependent module"
0
 
Wanting2LearnManAuthor Commented:
I have also installed the MS Visual C++ redistributable.  

Thanks
0
 
pgnatyukCommented:
Post the names you see in Dependency Walker.

Probably the redistributable package will solve it.
If you cannot, change the project settings.
0
 
js-profiCommented:
did you load the dll by LoadLibrary? you better would link an import lib of the dll lib to the app.
0
 
Wanting2LearnManAuthor Commented:
This is my complete exe which loads the dll.
 
#include <windows.h>
#include <iostream>

__declspec(dllimport) void WINAPI StartServer(void);

int main()
{
     std::cout<<"Welcome to my program"<<std::endl;

     StartServer();

     return 0;
}





I will post the  depwalker names soon,

Thanks
0
 
js-profiCommented:
ok the app loads the dll by statically by import library. the additional module needed must come from dll. you know that by not using extern "C" clause the name of the function serverStart was mangled by c++?
0
 
pgnatyukCommented:
It' WINAPI. _stdcall adds underscore as the prefix and @ with the number of bytes in the end of the name. The the whole decoration here.
0
 
hdesoukyCommented:
You should install the same version of your visual c runtime to the target application other wise you will get such strange errors
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.