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

<blockquote>
  <p>Please use the /MD switch for _AFXDLL builds</p>
</blockquote>

<p>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.</p>

<p>Is this really true? Are there any workaround available?</p>

[{'answer_id': 759, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>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.</p>\n\n<p>See <a href="http://www.mombu.com/microsoft/windows-programmer-win32/t-vs2005-and-nt4-392831.html" rel="noreferrer">this thread</a> for some background.</p>\n\n<p>Then start limiting your dependencies via preprocessor macros, and avoiding APIs which aren\'t supported on NT.</p>\n'}, {'answer_id': 23817, 'author': 'Adam Mitz', 'author_id': 2574, 'author_profile': 'https://Stackoverflow.com/users/2574', 'pm_score': 2, 'selected': False, 'text': "<p>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.</p>\n"}, {'answer_id': 94080, 'author': 'Eric', 'author_id': 12937, 'author_profile': 'https://Stackoverflow.com/users/12937', 'pm_score': 1, 'selected': False, 'text': '<p>Although I\'m not familiar with afxext.h, I am wondering what about it makes it incompatible with Windows NT4.... </p>\n\n<p>However, to answer the original question:\n"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."</p>\n\n<p>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.</p>\n\n<p>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.\'</p>\n\n<p>In reality the term \'NT\' is equal to the NT series. The NT series is NT3, NT4, NT5 (2000, XP, 2003) and NT6 (Vista).</p>\n\n<p>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 &amp; subsystem or, if this is a platform porting excercise, remove the MFC dependencies that VC is possibly imposing.</p>\n\n<p>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.</p>\n\n<p>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?</p>\n\n<p>Hopefully some of this will help you along.</p>\n'}, {'answer_id': 200955, 'author': 'MSalters', 'author_id': 15416, 'author_profile': 'https://Stackoverflow.com/users/15416', 'pm_score': 2, 'selected': False, 'text': '<p>The workaround is to fix the multi-threaded DLL. <a href="http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/2435c3ab-f732-467e-8224-5f4e3f12c10b/" rel="nofollow noreferrer">Simple instructions</a>. Short summary:</p>\n\n<blockquote>\n  <p>The shipping 8.0 C Runtime Library DLL (MSVCR80.DLL) does not support\n  NT 4.0 SP6 for one reason and one reason only: someone at Microsoft\n  added a function call to <code>GetLongPathNameW</code> which does not exist in\n  kernel32.dll on NT 4.0.</p>\n  \n  <p>CRTLIB.C   On line 577, there is a call to <code>GetLongPathNameW</code>.  simply replace it with: <code>ret = 0;</code>\n  only use this build of MSVCR80.DLL on NT 4.0.</p>\n</blockquote>\n\n<p>Once you\'ve got those working, coming up with a more generic solution should be trivial.</p>\n'}, {'answer_id': 307235, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': -1, 'selected': False, 'text': '<p>The idea is that the exe is needed to link to the static library.</p>\n\n<p>Please try this\n"Configuration Properties", "General", "Use of MFC" to "Use MFC in a Static Library"\n"Configuration Properties", "General", "Use of ATL" to "Static Link to ATL"</p>\n\n<p>"Configuration Properties", "C\\C++", "Code Generation", "Runtime Library" to "Multi-Threaded (\\MT)"</p>\n\n<p>Test Platform\nBuild Machine: Visual Studio 2005 on Window XP SP2\nClient Machine: Window XP SP2 (no VS2005 installed)</p>\n'}]
['https://Stackoverflow.com/questions/609', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/179/']