views:

300

answers:

3

hi I want to execute an exe file which is written in VC++.net 2008 in a computer which has windows xp and has not .net framework and none of c++ libraries. but when i run the file i get this error:

This application has failed to start because the application configuration is incorrect....

I want a way to put all dependency together to become free of this problem. does anyone know what should I do?

+1  A: 

You seem to be looking for a .Net linker, such as this one.

SLaks
how can I set in VS2008 for project to use from my dlls not from my system dlls?
JGC
You cannot do this for a .Net project without third-party software.
SLaks
I'm not serious in using .net I just want to use windows functions.do you know other environment which can solve my problem?
JGC
A: 

You have two basic choices: either write your program in pure C++ (or some other language that can/will produce completely standalone executable files) or else use a dependency walker to find what DLLs are needed, and package them up into an installation program.

The option you're suggesting (taking an existing executable that depends on some DLLS, and trying to "inject" the DLLs into the executable) is pretty much unworkable. In theory, you could (for example) create an installation program as an executable and just have the user re-run the installation program every time they want to run your program. This will usually add enough overhead that your users probably won't like it.

Likewise, you could put the DLL in the executable as a binary resource and use FindResource, LoadResource, etc., to write its content out to a temporary file -- but this requires some semi-advanced programming, and it still imposes a fair amount of overhead.

Jerry Coffin
is there any way that i can put my dlls near my executable file and be able to use them?
JGC
@JGC:Yes --if you copy them into the same directory with the executable, the system will be able to find them.
Jerry Coffin
+1  A: 

If you are writing a pure C++ application (Win32 only, no .NET), then you want to staticly link the C++ run time, which can be changed in your project's properties. See this answer for the instructions. (It is for VC2005, but the steps are the same in VC2008)

shf301