Build for Windows NT 4.0 using Visual Studio 2005?

2019-02-11 17:58发布

An MFC application that I'm trying to migrate uses afxext.h, which causes _AFXDLL to get set, which causes this error if I set /MT:

Please use the /MD switch for _AFXDLL builds

My research to date indicates that it is impossible to build an application for execution on Windows NT 4.0 using Visual Studio (C++, in this case) 2005.

Is this really true? Are there any workaround available?

5条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-11 18:05

No, there are many applications built with VS2005 that have to support Windows XP, 2000, NT, the whole stack. The issue is that (by default) VS2005 wants to use libraries/exports not present on NT.

See this thread for some background.

Then start limiting your dependencies via preprocessor macros, and avoiding APIs which aren't supported on NT.

查看更多
迷人小祖宗
3楼-- · 2019-02-11 18:14

To get rid of the _AFXDLL error, have you tried changing to the settings to use MFC as a static lib instead of a DLL? This is similar to what you're already doing in changing the runtime libs to static instead of DLL.

查看更多
倾城 Initia
4楼-- · 2019-02-11 18:15

The workaround is to fix the multi-threaded DLL. Simple instructions. Short summary:

The shipping 8.0 C Runtime Library DLL (MSVCR80.DLL) does not support NT 4.0 SP6 for one reason and one reason only: someone at Microsoft added a function call to GetLongPathNameW which does not exist in kernel32.dll on NT 4.0.

CRTLIB.C On line 577, there is a call to GetLongPathNameW. simply replace it with: ret = 0; only use this build of MSVCR80.DLL on NT 4.0.

Once you've got those working, coming up with a more generic solution should be trivial.

查看更多
该账号已被封号
5楼-- · 2019-02-11 18:15

The idea is that the exe is needed to link to the static library.

Please try this "Configuration Properties", "General", "Use of MFC" to "Use MFC in a Static Library" "Configuration Properties", "General", "Use of ATL" to "Static Link to ATL"

"Configuration Properties", "C\C++", "Code Generation", "Runtime Library" to "Multi-Threaded (\MT)"

Test Platform Build Machine: Visual Studio 2005 on Window XP SP2 Client Machine: Window XP SP2 (no VS2005 installed)

查看更多
男人必须洒脱
6楼-- · 2019-02-11 18:23

Although I'm not familiar with afxext.h, I am wondering what about it makes it incompatible with Windows NT4....

However, to answer the original question: "My research to date indicates that it is impossible to build an application for execution on Windows NT 4.0 using Visual Studio (C++, in this case) 2005."

The answer should be yes especially if the application was originally written or running on NT4! With the afxext.h thing aside, this should be an easy YES.

The other thing I am finding trouble with is the loose nature in which people are throwing out the NT term. Granted most people think of 'NT' as Windows NT4 but it's still ambiguous because 'most people' is not equal to 'all people.'

In reality the term 'NT' is equal to the NT series. The NT series is NT3, NT4, NT5 (2000, XP, 2003) and NT6 (Vista).

Win32 is a subsystem which you target your C/C++ code too. So I see no reason why one should not be able target this NT4 platform & subsystem or, if this is a platform porting excercise, remove the MFC dependencies that VC is possibly imposing.

Adding the afxext.h to the mix, it sounds to me like a subsystem compatibility issue. It's part of MFC from my Google research. The afxext.h appears to be the MFC (Microsoft Foundation Class) extensions.

Can you remove your dependency on MFC? What type of application is this? (CLR, service, GUI interface?) Can you convert project to an unmanaged C++ project in VC 8.0?

Hopefully some of this will help you along.

查看更多
登录 后发表回答