none
After installing VS 2010 SP1, I'm getting nafxcwd.lib(afxglobals.obj) : error LNK2001: unresolved external symbol _IID_IWICImagingFactory

答案

  • Hi Clint,

     

    I just tested a short codes with IID_IWICImagingFactory in Visual Studio 2010 SP1, and I'm not clear if these codes is the part of your project.

     

    	CoInitialize(NULL);
    
    // The factory pointer
    	IWICImagingFactory *pFactory = NULL;
    
    // Create the COM imaging factory
    	HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory,NULL,CLSCTX_INPROC_SERVER,IID_IWICImagingFactory,(void**)&pFactory);
    

    In this codes, you need to include the windowscodecs.lib file into project. This lib is provided by the Windows Software Development Kit (SDK).

     

    Therefore, I would like you to install the Windows Software Development Kit (SDK) first, and then

    Right Click your project->Properties->Configuration Properties->Linker->General->Additional Include Directories and add windowscodecs.lib

     

    I hope my suggestions can help you to solve this problem.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年8月8日 8:09
    版主

全部回复

  • Hi Client,

     

    Would you please provide us some sample codes which can reproduce this problem? Like when you call some function in that nafxcwd.lib file. With this sample codes, we can find the reason of this problem quickly and directly.

     

    It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年6月8日 3:52
    版主
  • Looks like you are static linking MFC. a new member of type IWICImagingFactory* is introduced in AFX_GLOBAL_DATA, so you need to link windowscodecs.lib. There is a new Direct2D member too but the IID of Direct2D is taken care of by uuid.lib.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2011年6月10日 3:11
  • Hi Clint,

     

    Would you mind letting me know the result of the suggestions? If you need further assistance, feel free to let me know. I will be more than happy to be of assistance.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年6月15日 3:47
    版主
  • It would be difficult to provide an example as it isn't us that's linking in the headers that cause this issue.

     

    Again, if you use the pre SP1 version of these files, it will build fine.

    2011年8月5日 21:37
  • Hi Clint,

     

    I just tested a short codes with IID_IWICImagingFactory in Visual Studio 2010 SP1, and I'm not clear if these codes is the part of your project.

     

    	CoInitialize(NULL);
    
    // The factory pointer
    	IWICImagingFactory *pFactory = NULL;
    
    // Create the COM imaging factory
    	HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory,NULL,CLSCTX_INPROC_SERVER,IID_IWICImagingFactory,(void**)&pFactory);
    

    In this codes, you need to include the windowscodecs.lib file into project. This lib is provided by the Windows Software Development Kit (SDK).

     

    Therefore, I would like you to install the Windows Software Development Kit (SDK) first, and then

    Right Click your project->Properties->Configuration Properties->Linker->General->Additional Include Directories and add windowscodecs.lib

     

    I hope my suggestions can help you to solve this problem.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年8月8日 8:09
    版主
  • Hi Clint,

     

    Would you mind letting me know the result of the suggestions? If you need further assistance, feel free to let me know. I will be more than happy to be of assistance.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年8月10日 9:09
    版主
  • Hi Clint,

     

    I marked my reply as answer, if your issue have not been solved please unmark it and update more information about this issue.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年8月15日 1:34
    版主
  • FYI:
    I had the same problem on one of my machines.

    It was caused by an incomplete update.
    VS 2010 SP1 was installed, ie, libs and binaries were all up to date. But the header file were not updated.
    Using WinMerge from one computer to another showed 88 differences for the VC folder. All headers! After the files have been replaced manually, the linker error was gone.

    Just check line 128, auf AFX.H this line contains the information to pull the windows codec library.


    Martin Richter -- MVP for VC++ [Germany] -- http://blog.m-ri.de
    2011年9月14日 8:36
    版主
  • I also have this issue. I installed VS2010 (without SP1) + Window SDK for x64 machine. After compling, i stilll got this bug. Adding windowscodecs.lib into Project Properties > Linker > Input > Additional Dependencies doesn't solve the problem. Has any one had other suggestions, please  ? 

     

    4>stdafx.obj : error LNK2019: unresolved external symbol _WTSSendMessageA@40 referenced in function _SendNotification
    4>nafxcw.lib(afxtaskspane.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12
    4>nafxcw.lib(afxvisualmanager.obj) : error LNK2019: unresolved external symbol __imp__ImageList_GetIconSize@12 referenced in function "public: virtual void __thiscall CMFCVisualManager::OnDrawTask(class CDC *,class CMFCTasksPaneTask *,class CImageList *,int,int)" (?OnDrawTask@CMFCVisualManager@@UAEXPAVCDC@@PAVCMFCTasksPaneTask@@PAVCImageList@@HH@Z)
    4>nafxcw.lib(afxheaderctrl.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12
    4>nafxcw.lib(afxvisualmanagerofficexp.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2001: unresolved external symbol __imp__ImageList_GetIconSize@12
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2019: unresolved external symbol __imp__ImageList_ReplaceIcon@12 referenced in function "public: void __thiscall CMFCStatusBar::SetPaneAnimation(int,struct _IMAGELIST *,unsigned int,int)" (?SetPaneAnimation@CMFCStatusBar@@QAEXHPAU_IMAGELIST@@IH@Z)
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2019: unresolved external symbol __imp__ImageList_GetIcon@12 referenced in function "public: void __thiscall CMFCStatusBar::SetPaneAnimation(int,struct _IMAGELIST *,unsigned int,int)" (?SetPaneAnimation@CMFCStatusBar@@QAEXHPAU_IMAGELIST@@IH@Z)
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2019: unresolved external symbol __imp__ImageList_Create@20 referenced in function "public: void __thiscall CMFCStatusBar::SetPaneAnimation(int,struct _IMAGELIST *,unsigned int,int)" (?SetPaneAnimation@CMFCStatusBar@@QAEXHPAU_IMAGELIST@@IH@Z)
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2019: unresolved external symbol __imp__ImageList_GetImageCount@4 referenced in function "public: void __thiscall CMFCStatusBar::SetPaneAnimation(int,struct _IMAGELIST *,unsigned int,int)" (?SetPaneAnimation@CMFCStatusBar@@QAEXHPAU_IMAGELIST@@IH@Z)
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2019: unresolved external symbol __imp__ImageList_Destroy@4 referenced in function "public: void __thiscall CMFCStatusBar::SetPaneAnimation(int,struct _IMAGELIST *,unsigned int,int)" (?SetPaneAnimation@CMFCStatusBar@@QAEXHPAU_IMAGELIST@@IH@Z)
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2019: unresolved external symbol __imp__ImageList_AddMasked@12 referenced in function "public: void __thiscall CMFCStatusBar::SetPaneIcon(int,struct HBITMAP__ *,unsigned long,int)" (?SetPaneIcon@CMFCStatusBar@@QAEXHPAUHBITMAP__@@KH@Z)
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2019: unresolved external symbol __imp__ImageList_Remove@8 referenced in function "public: void __thiscall CMFCStatusBar::SetPaneIcon(int,struct HBITMAP__ *,unsigned long,int)" (?SetPaneIcon@CMFCStatusBar@@QAEXHPAUHBITMAP__@@KH@Z)
    4>nafxcw.lib(afxstatusbar.obj) : error LNK2019: unresolved external symbol __imp__ImageList_DrawEx@40 referenced in function "protected: virtual void __thiscall CMFCStatusBar::OnDrawPane(class CDC *,class CMFCStatusBarPaneInfo *)" (?OnDrawPane@CMFCStatusBar@@MAEXPAVCDC@@PAVCMFCStatusBarPaneInfo@@@Z)
    

    • 已编辑 bubuzzz 2011年11月29日 4:16
    2011年11月29日 4:13
  • Problem solved ! I removed the nafxcw.lib from the linker and add

    #include <atlbase.h>

    to stfafx.h. It works :D


    • 已编辑 bubuzzz 2011年11月29日 6:04
    2011年11月29日 4:47
  • Problem solved ! I removed the nafxcw.lib from the linker and add

    #include <atlbase.h>

    to stfafx.h. It works :D


    It really works! thanks very much. the question is: what is the role of this <atlbase.h> file in solving the problem?
    2012年2月21日 5:55
  • Thank you Martin for your helpful tip.

    I was reluctant to copy files between two different VC installations manually. To solve this problem, I performed:

    1. uninstall of VS 2010 SP1
    2. reboot
    3. uninstall of VS 2010
    4. reboot
    5. install of VS 2010
    6. reboot
    7. install of VS 2010 SP1

    2012年10月29日 13:45
  • I leveraged what Rozi wrote but limited my changes to VS 2010 SP1:

    1. uninstall of VS 2010 SP1
    2. reboot
    3. install of VS 2010 SP1

    And those steps worked for me.

    2013年2月27日 19:51
  • At project->Properties->Configuration Properties->Linker->Input->Additional Dependencies I added windowscodecs.lib. That fixed my problem
    2014年5月20日 14:21
  • If I am on window 7 Sp1, what version of the SDK needs to be installed.

    Does this link represent all versions of supported SDK ?

    2015年7月24日 18:28
  • Thanks! That solved the problem for me!
    2017年5月5日 6:25