Linker: cannot open file 'nafxcwd.lib'

user922871 picture user922871 · Jun 28, 2014 · Viewed 18.1k times · Source

I have problem with compiling my project via visual studio 2013. I got this linker error:

LINK : fatal error LNK1104: cannot open file 'nafxcwd.lib'

According to this page, I must use MFC in shared library. But I don't use MFC at all.
All my libraries and main project compiled using Use Standard Windows Libraries settings. This problem occurs only when I try to build project via Visual Studio 2013 toolchain, but it successfully built with Visual Studio 2010 toolchain.

P.S. project has been moved from Visual Studio 6.0 to Visual Studio 2013.

Answer

user4272649 picture user4272649 · Aug 11, 2015

It appears that in Microsoft Visual C++ 6.0 Standard Edition does not support statically linking with the MFC libraries as the Microsoft page says . But in Visual Studio 2013 you can link staticaly with Microsoft Libraries . Check this link https://support.microsoft.com/en-us/kb/243458 in order to solve your problem.

From The Microsoft Site :

To change your MFC project setting to link dynamically to the MFC libraries, perform the following steps: Open your MFC project.

  1. From the Project menu, click Settings.
  2. In the Settings For combo box, select All Configurations. Click the General tab. If it is not visible, use the tab scroll buttons to scroll to the left.
  3. In the Microsoft Foundation Classes combo box, select Use MFC in a Shared DLL. Click OK to save the changes.