Click here to Skip to main content
15,894,070 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I'd like to create and compile an application in c++.
But I want it to be able to run in any Windows XP machine (or greater -if possible) without needing anything to be pre-installed (such as libraries, NET, or Service Packs anything that doesn't come on the original windows CD by default).

Is it enough if I choose Win32 project in the dialog that prompts when creating a new project?

If I use any "#includes" or any external libraries/dll's does the machine which runs the program need to have them installed?
If so, how can I make the c++ compiler put them into the exe?

To sum up: What I'm trying to accomplish is create an exe which doesn't need anything else to run.
How can I do it?

PS: If i can't which would be the minimum things the computer will need?
Posted

If you are using C++ and not c++/clr then you won't be using .net and that is not an issue.

There is a question of what you mean by "pre-installed". You can create a setup/install package that installs your program together with dll's and ocx's that it uses. They don't need to be "pre-installed", but will be installed as part of your program's installation.

If you mean that you want to copy just your exe to the computer and have it run with no installation, then you cannot use any dll's or ocx's that do not ship with the version of windows that you want to run on. "#includes" don't matter, but what is in them might. Statically linked libraries are included in your exe, dynamically linked libraries (DLLs) aren't. ActiveX controls are a form of dll. Note that the dlls for some versions of the runtime library and mfc ship with windows, so if you are using one of those versions, you could rely on it being there. (though there can be versioning problems with dlls.) You might also be able to link it statically instead.

BecquerII wrote:
Is it enough if I choose Win32 project


Not if you then write your program to use a third party dll.

BecquerII wrote:
If i can't which would be the minimum things the computer will need?


It depends what you put in your program.
 
Share this answer
 
If I understand correctly you want to build an exe on your machine and then run it on any XP+ computer?

Just be sure to link all your dependecies statically. For the VC++ CRT, here is a link how to do that.[^]
 
Share this answer
 
I see what you are trying to do, however, I don't see how this is possible. The biggest problem is that you can't be sure that ANY development tools are installed. Unlike UNIX there is not a single compiler for any language installed in windows by default.

You choice is probably to use something like a clickonce deployment.

Something you might want to consider is using something that is almost guaranteed to be there, like VBScript.
 
Share this answer
 
v3

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