windows - Compability of c++ program exe -
these days i'm working on windows programming. following code won't run on windows computer, why?
#include <stdio.h> #include <windows.h> int main() { tchar tcwindowspath[max_path]; tchar tccurrentpath[max_path]; getwindowsdirectory(tcwindowspath, max_path); getsystemdirectory(tccurrentpath, max_path); printf("%s \n", tcwindowspath); printf("%s \n", tccurrentpath); //////////////////////////////////////// }
choosing appropriate runtime environment project settings:
configuration propertes -> c/c++ -> code generation -> runtime library
will determine if rely on statically linking project runtime or dynamically linking via dlls. if choose dynamically link runtime dlls need present on system running on.
choosing /mt options statically link executable allowing run on system without installing visual c++ redistributable run time components. if choose /md options system running on need have installed. installing redistributables such recent, visual c++ redistributable 2015.
here decent in detail write on this.
update:
in addition comment below static vs dynamic linking... can set target platform with:
configuration properties -> general -> platform toolset
i not sure other computer running on, if xp, 2015 has option visual studio 2015 - windows xp (v140_xp). make sure platform targeting covered development platform.
this article targets answer .net perspective information relevant.
Comments
Post a Comment