winapi - How to deploy a Win32 API application as an executable -


how can deploy win32 application exe application others (who don't have vc++ installed) can use it?

i using vc++ 2010 on windows 7.

if switch "release" mode when compile finished program (rather "debug", use debugging during development), should executable run on computer without visual studio installed.

however, executable still require appropriate version of c runtime library installed. example, if developed in visual c++ 2010, need version 10 of crt installed. freely redistributable library, downloadable here.

so, have several options deployment:

  1. manual deployment

    give people bare executable file, , include installer redistributable in folder on installation media. if copy executable disk , cannot run because error message, should install crt libraries included redistributable installer. executable run fine.

    this works great if have relatively computer-savvy audience, or you're deploying fixed range of machines (like across school or corporation). doesn't work general deployment customers.

    in fact, don't need installer. can place crt dlls in same folder executable , run fine. how test apps i'm developing on clean vms. works charm. there's no need run crt installer @ all. you'll find these required libraries part of visual studio installation:

    <program files folder>\microsoft visual studio 10.0\vc\redist\x86 
  2. automated deployment

    create setup program automatically installs application along dependencies requires, including crt redistributable. see commercial applications doing. recommend trivial of apps.

    full versions of visual studio 2010 (i.e., not express versions) can create setup project can customize needed work installer application. no longer recommended way create installer, , functionality has been removed latest version of visual studio, 2012.

    so recommend using else, if have older version of vs setup project available. no point in wasting time creating you'll have update later. personal favorite choices creating setup programs wix , inno setup. both free, , extensive documentation available online.

    creating simple setups don't have quite straightforward—this case you, need install crt redistributable if not there. i'd willing bet money can find walkthrough or example online how in either wix or inno setup.

    if need more complicated stuff, both of these setup packages support it. extensively customizable , powerful, takes more work going.

  3. static linking

    if absolutely need able distribute bare executable guaranteed work when double-clicked, need switch project statically link in required runtime libraries. means of crt code embedded linker directly executable, , means don't have redistribute crt libraries separately.

    the disadvantage of approach way benefit improvements, bug fixes, , security patches released crt recompile , redistribute application. if dynamically link (the default), app automatically benefit enhancements installed version of crt libraries. microsoft recommends against static linking.

    to switch between these modes in visual studio, follow these steps:

    • right-click on project in solution explorer , select "properties".
    • ensure "release" configuration selected in drop-down box @ top of dialog.
    • expand "c/c++" item in treeview, , select "code generation".
    • change setting of "runtime library" option "multi-threaded (/mt)".

    a further description on these cryptic compiler switches mean , ones should use when given in my answer here.

final note: "debug" versions of crt libraries not redistributable, doesn't matter because should always distribute "release" build of app anyway, never "debug" build.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -