From: wmc on
I moved a very old dos (console) app written in C into VS6 and compiled
it with minimal changes.

This week when I took the same code and moved it into VS2008 I got an
exe which would not run on the W2K and XP target systems. I've had
little luck with a web search re finding a way to build the exe so that
it will run on XP and possibly W2K.

I tried changing the value in targetver.h to 0x0501 (as shown below) but
noticed that when I browse the value in the object browser it still
shows 0x0600 (Vista).

Yet, when I navigate with 'go to definition', 'go to declaration', and
'find all references' the result is this location in targetver.h which
no longer has the 0x0600 value. And I don's see any other header files
that might be defining the windows version.

#ifndef _WIN32_WINNT // Specifies that the min req is Vista
#define _WIN32_WINNT 0x0501 // Change to approp value to target...
#endif

It's acceptable for this case to manually register dll's on the few
target systems that need this legacy exe (haven't looked at the exe with
dependency walker) or even move the revamped code back to VS6, but I
wondered if there was an easy solution with setting up VS2008.

thx,

-williamc


From: wmc on
wmc wrote:
> I moved a very old dos (console) app written in C into VS6 and compiled
> it with minimal changes.
>
> This week when I took the same code and moved it into VS2008 I got an
> exe which would not run on the W2K and XP target systems. I've had
> little luck with a web search re finding a way to build the exe so that
> it will run on XP and possibly W2K.
>
> I tried changing the value in targetver.h to 0x0501 (as shown below) but
> noticed that when I browse the value in the object browser it still
> shows 0x0600 (Vista).
>
> Yet, when I navigate with 'go to definition', 'go to declaration', and
> 'find all references' the result is this location in targetver.h which
> no longer has the 0x0600 value. And I don's see any other header files
> that might be defining the windows version.
>
> #ifndef _WIN32_WINNT // Specifies that the min req is Vista
> #define _WIN32_WINNT 0x0501 // Change to approp value to target...
> #endif
>
> It's acceptable for this case to manually register dll's on the few
> target systems that need this legacy exe (haven't looked at the exe with
> dependency walker) or even move the revamped code back to VS6, but I
> wondered if there was an easy solution with setting up VS2008.
>
> thx,
>
> -williamc
>
>

Some additional info. After examining the VS2008 exe with the VS6
dependency walker it appears that the dll that is probably not found on
the XP system is MSVCR900.DLL.
From: ScottMcP [MVP] on
On Jan 20, 9:50 am, wmc <...> wrote:
> Some additional info. After examining the VS2008 exe with the VS6
> dependency walker it appears that the dll that is probably not found on
> the XP system is MSVCR900.DLL.- Hide quoted text -

That DLL is the C runtime library in DLL form. You can eliminate the
dependency on that DLL by using static linking to the C runtime
library. Static linking puts the required runtime lib routines inside
your exe file instead of using the DLL.

In VS2008 that setting is in Project Properties, C/C++, Code
Generation. Set "Runtime Library" to /MT in the release build, and
to /MTd in the debug build.

From: wmc on
ScottMcP [MVP] wrote:
> On Jan 20, 9:50 am, wmc <...> wrote:
>> Some additional info. After examining the VS2008 exe with the VS6
>> dependency walker it appears that the dll that is probably not found on
>> the XP system is MSVCR900.DLL.- Hide quoted text -
>
> That DLL is the C runtime library in DLL form. You can eliminate the
> dependency on that DLL by using static linking to the C runtime
> library. Static linking puts the required runtime lib routines inside
> your exe file instead of using the DLL.
>
> In VS2008 that setting is in Project Properties, C/C++, Code
> Generation. Set "Runtime Library" to /MT in the release build, and
> to /MTd in the debug build.
>

Thank you! I'll try that...

--williamc