Hi,
I have searched the internet high and low but all posts I have found on this topic have been confusing to me... It is quite clear that there is something basic I am not getting... please help...

My applications are written in VC++ 2008 Express and all source code is included in my projects (no .dlls used, just #include <windows.h> etc). The debug exe files run fine on my PC which has VC++ Express which is OK for now. But if anyone could explain how to compile an exe file from a project that will run on a second PC without installation of anything that would be great. Keep it simple as I am new to this field... The file size can be big, that is no problem. I just want to be able to share an application without telling the user to install something other than my program. If I have to purchase something, what would that be? How much would it cost?

Thanks!

Dani AI

Generated

Two practical ways to get a VC++ 2008 Express build that runs on another PC: 1) produce a standalone EXE by statically linking the C runtime, or 2) ship the Visual C++ runtime alongside the app (official redistributable or private assembly). Debug builds depend on non-redistributable debug CRTs and therefore are not suitable for sharing.

For a self-contained EXE, set the project configuration to Release and change the Runtime Library to Multi-threaded (/MT) under Project Properties -> C/C++ -> Code Generation. Rebuild and the CRT will be linked into the executable (larger file, fewer deployment steps). The Release output normally appears in the project Release folder. It is important to test the result on a clean machine or VM; use a dependency inspector (Dependency Walker or similar) to confirm no missing DLLs. Note: mixing modules built with different CRT types (static /MT vs dynamic /MD) can cause runtime issues when CRT-managed resources cross module boundaries.

If keeping the default dynamic CRT, the target PC must have the VC++ runtime installed. The usual approaches are to include the official Visual C++ redistributable installer with the package or use the side-by-side private assembly layout (CRT DLLs plus manifest) rather than copying DLLs into system folders. Express editions do not include built-in setup project support; lightweight installer builders such as Inno Setup or NSIS are common free options, while full setup project support is available in paid Visual Studio SKUs.

Both and pointed toward the correct directions: Release builds are the right base, and command-line builds work too but IDE/MSBuild settings are simpler for multi-file projects. Testing on a clean environment is the final, essential step.

Recommended Answers

All 5 Replies

I've found that compiling from the command line gives an executable that will stand alone. At least for projects with a single source code file.

All you have to do is compile it for Release instead of Debug. You may have to install some Microsoft dll's found here: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT" if the computer does not already have them or newer versions of them.

I've found that compiling from the command line gives an executable that will stand alone. At least for projects with a single source code file.

Interesting... My projects have many source code files but I should give it a shot and see if it works. What is the syntax for compiling from the command line?

Thanks!

All you have to do is compile it for Release instead of Debug. You may have to install some Microsoft dll's found here: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT" if the computer does not already have them or newer versions of them.

With install, do you mean copy them over to the other PC or do they need to be installed with an installer to get entries in the registry? I see that my PC has 3 .dll files and one manifest in that location (slightly different path though). If the installation is just a copy, what target location should they reside in? The same?

Thanks!

Interesting... My projects have many source code files but I should give it a shot and see if it works. What is the syntax for compiling from the command line?

Thanks!

Look here

And see for info on setting the project to statically link the libraries.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.